Author: petergibbs
Date: Thu Feb 21 06:21:26 2008
New Revision: 25930
Modified:
trunk/languages/lua/pmc/luastring.pmc
Log:
In tonumber, wait until we have finished with the C string before releasing it.
This significantly improves the 'make test' results for lua.
Modified: trunk/languages/lua/pmc/luastring.pmc
==============================================================================
--- trunk/languages/lua/pmc/luastring.pmc (original)
+++ trunk/languages/lua/pmc/luastring.pmc Thu Feb 21 06:21:26 2008
@@ -1011,8 +1011,6 @@
/* at least one valid digit? */
if (s1 != s2) {
- string_cstring_free(s1);
-
/* skip trailing spaces */
while (isspace((unsigned char)(*s2)))
s2++;
@@ -1020,6 +1018,7 @@
if (*s2 == '\0') { /* no invalid trailing characters? */
PMC *retval = pmc_new(INTERP, dynpmc_LuaNumber);
VTABLE_set_number_native(INTERP, retval, d);
+ string_cstring_free(s1);
return retval;
}
}