Revamp of 'lua_pushfstring' / 'luaO_pushvfstring'

The function 'luaO_pushvfstring' now uses an internal buffer to
concatenate small strings, instead of pushing all pieces on the
stack. This avoids the creation of several small Lua strings for each
piece of the result. (For instance, a format like "n: '%d'" used to
create three intermediate strings: "n: '", the numeral, and "'".
Now it creates none.)
This commit is contained in:
Roberto Ierusalimschy
2019-04-24 14:01:20 -03:00
parent 20b161e285
commit 3da34a5fa7
4 changed files with 177 additions and 44 deletions

View File

@@ -578,13 +578,6 @@
#endif
/*
@@ lua_pointer2str converts a pointer to a readable string in a
** non-specified way.
*/
#define lua_pointer2str(buff,sz,p) l_sprintf(buff,sz,"%p",p)
/*
@@ lua_number2strx converts a float to a hexadecimal numeric string.
** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that.