aboutsummaryrefslogtreecommitdiff
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-dad808a73a98a23729614b8814728d76b4e5d577.tar.gz
lua-dad808a73a98a23729614b8814728d76b4e5d577.tar.bz2
lua-dad808a73a98a23729614b8814728d76b4e5d577.zip
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 @@
1/* 1/*
2** $Id: lobject.c,v 1.47 2000/09/11 20:29:27 roberto Exp roberto $ 2** $Id: lobject.c,v 1.48 2000/09/12 13:47:39 roberto Exp roberto $
3** Some generic functions over Lua objects 3** Some generic functions over Lua objects
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -18,7 +18,7 @@
18 18
19 19
20/* 20/*
21** you can use the fact that the 3rd letter or each name is always different 21** you can use the fact that the 3rd letter of each name is always different
22** (e-m-r-b-n-l) to compare and switch these strings 22** (e-m-r-b-n-l) to compare and switch these strings
23*/ 23*/
24const char *const luaO_typenames[] = { /* ORDER LUA_T */ 24const char *const luaO_typenames[] = { /* ORDER LUA_T */
@@ -61,6 +61,7 @@ int luaO_equalObj (const TObject *t1, const TObject *t2) {
61char *luaO_openspace (lua_State *L, size_t n) { 61char *luaO_openspace (lua_State *L, size_t n) {
62 if (n > L->Mbuffsize) { 62 if (n > L->Mbuffsize) {
63 luaM_reallocvector(L, L->Mbuffer, n, char); 63 luaM_reallocvector(L, L->Mbuffer, n, char);
64 L->nblocks += (n - L->Mbuffsize)*sizeof(char);
64 L->Mbuffsize = n; 65 L->Mbuffsize = n;
65 } 66 }
66 return L->Mbuffer; 67 return L->Mbuffer;
@@ -127,10 +128,10 @@ int luaO_str2d (const char *s, Number *result) { /* LUA_NUMBER */
127} 128}
128 129
129 130
130/* this function needs to handle only '%d' and '%.XXXs' formats */ 131/* this function needs to handle only '%d' and '%.XXs' formats */
131void luaO_verror (lua_State *L, const char *fmt, ...) { 132void luaO_verror (lua_State *L, const char *fmt, ...) {
132 char buff[500];
133 va_list argp; 133 va_list argp;
134 char buff[600]; /* to hold formated message */
134 va_start(argp, fmt); 135 va_start(argp, fmt);
135 vsprintf(buff, fmt, argp); 136 vsprintf(buff, fmt, argp);
136 va_end(argp); 137 va_end(argp);