summaryrefslogtreecommitdiff
path: root/lobject.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-29 09:42:13 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2000-09-29 09:42:13 -0300
commitdad808a73a98a23729614b8814728d76b4e5d577 (patch)
tree945fabce1906c5f08fe6512476d7ca3d84017bca /lobject.c
parentca7fd50a4ec2f1b41292f859ba0d5e52a2b22a5c (diff)
downloadlua-github-dad808a73a98a23729614b8814728d76b4e5d577.tar.gz
new way to count `nblocks' for GC (try to count bytes).
Diffstat (limited to 'lobject.c')
-rw-r--r--lobject.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/lobject.c b/lobject.c
index c58d4bc2..2256e953 100644
--- a/lobject.c
+++ b/lobject.c
@@ -1,5 +1,5 @@
/*
-** $Id: lobject.c,v 1.47 2000/09/11 20:29:27 roberto Exp roberto $
+** $Id: lobject.c,v 1.48 2000/09/12 13:47:39 roberto Exp roberto $
** Some generic functions over Lua objects
** See Copyright Notice in lua.h
*/
@@ -18,7 +18,7 @@
/*
-** you can use the fact that the 3rd letter or each name is always different
+** you can use the fact that the 3rd letter of each name is always different
** (e-m-r-b-n-l) to compare and switch these strings
*/
const char *const luaO_typenames[] = { /* ORDER LUA_T */
@@ -61,6 +61,7 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) {
char *luaO_openspace (lua_State *L, size_t n) {
if (n > L->Mbuffsize) {
luaM_reallocvector(L, L->Mbuffer, n, char);
+ L->nblocks += (n - L->Mbuffsize)*sizeof(char);
L->Mbuffsize = n;
}
return L->Mbuffer;
@@ -127,10 +128,10 @@ int luaO_str2d (const char *s, Number *result) { /* LUA_NUMBER */
}
-/* this function needs to handle only '%d' and '%.XXXs' formats */
+/* this function needs to handle only '%d' and '%.XXs' formats */
void luaO_verror (lua_State *L, const char *fmt, ...) {
- char buff[500];
va_list argp;
+ char buff[600]; /* to hold formated message */
va_start(argp, fmt);
vsprintf(buff, fmt, argp);
va_end(argp);