long strings are created directly in final position when possible

(instead of using an auxiliar buffer to first create the string
and then allocate the final string and copy result there)
This commit is contained in:
Roberto Ierusalimschy
2015-09-08 12:41:05 -03:00
parent 502214f8a5
commit 41964648ee
11 changed files with 62 additions and 58 deletions

12
lzio.c
View File

@@ -1,5 +1,5 @@
/*
** $Id: lzio.c,v 1.35 2012/05/14 13:34:18 roberto Exp roberto $
** $Id: lzio.c,v 1.36 2014/11/02 19:19:04 roberto Exp roberto $
** Buffered streams
** See Copyright Notice in lua.h
*/
@@ -66,13 +66,3 @@ size_t luaZ_read (ZIO *z, void *b, size_t n) {
return 0;
}
/* ------------------------------------------------------------------------ */
char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) {
if (n > buff->buffsize) {
if (n < LUA_MINBUFFER) n = LUA_MINBUFFER;
luaZ_resizebuffer(L, buff, n);
}
return buff->buffer;
}