diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-09 18:29:33 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-09 18:29:33 -0200 |
commit | 03d8a9bf0d8d9c149c0c2c0ae63732a8bfa512fd (patch) | |
tree | 7cc200dbbf6ac892ef2607683c50ae28f3f86fab | |
parent | d2e340f467a46017fa3526074c1756124e569880 (diff) | |
download | lua-03d8a9bf0d8d9c149c0c2c0ae63732a8bfa512fd.tar.gz lua-03d8a9bf0d8d9c149c0c2c0ae63732a8bfa512fd.tar.bz2 lua-03d8a9bf0d8d9c149c0c2c0ae63732a8bfa512fd.zip |
details
-rw-r--r-- | llimits.h | 4 | ||||
-rw-r--r-- | lstring.c | 7 | ||||
-rw-r--r-- | ltests.c | 6 |
3 files changed, 9 insertions, 8 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: llimits.h,v 1.20 2000/11/24 17:39:56 roberto Exp roberto $ | 2 | ** $Id: llimits.h,v 1.21 2000/12/04 18:33:40 roberto Exp roberto $ |
3 | ** Limits, basic types, and some other "installation-dependent" definitions | 3 | ** Limits, basic types, and some other "installation-dependent" definitions |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -90,7 +90,7 @@ typedef luint32 Instruction; | |||
90 | ** (accordingly, size_u will be 10, and size_a will be 5) | 90 | ** (accordingly, size_u will be 10, and size_a will be 5) |
91 | */ | 91 | */ |
92 | #define SIZE_INSTRUCTION 32 | 92 | #define SIZE_INSTRUCTION 32 |
93 | #define SIZE_B 9 | 93 | #define SIZE_B 8 |
94 | 94 | ||
95 | #define SIZE_OP 6 | 95 | #define SIZE_OP 6 |
96 | #define SIZE_U (SIZE_INSTRUCTION-SIZE_OP) | 96 | #define SIZE_U (SIZE_INSTRUCTION-SIZE_OP) |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 1.56 2001/02/09 19:53:16 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.57 2001/02/09 20:22:29 roberto Exp roberto $ |
3 | ** String table (keeps all strings handled by Lua) | 3 | ** String table (keeps all strings handled by Lua) |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -89,13 +89,12 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { | |||
89 | 89 | ||
90 | 90 | ||
91 | TString *luaS_newudata (lua_State *L, size_t s, void *udata) { | 91 | TString *luaS_newudata (lua_State *L, size_t s, void *udata) { |
92 | union L_UTString *uts = (union L_UTString *)luaM_malloc(L, sizeudata(s)); | 92 | TString *ts = (TString *)luaM_malloc(L, sizeudata(s)); |
93 | TString *ts = &uts->ts; | ||
94 | ts->marked = 0; | 93 | ts->marked = 0; |
95 | ts->nexthash = NULL; | 94 | ts->nexthash = NULL; |
96 | ts->len = s; | 95 | ts->len = s; |
97 | ts->u.d.tag = 0; | 96 | ts->u.d.tag = 0; |
98 | ts->u.d.value = (s > 0) ? uts+1 : udata; | 97 | ts->u.d.value = (s > 0) ? getstr(ts) : udata; |
99 | /* insert it on table */ | 98 | /* insert it on table */ |
100 | newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size)); | 99 | newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size)); |
101 | return ts; | 100 | return ts; |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: ltests.c,v 1.65 2001/02/09 19:53:16 roberto Exp roberto $ | 2 | ** $Id: ltests.c,v 1.66 2001/02/09 20:22:29 roberto Exp roberto $ |
3 | ** Internal Module for Debugging of the Lua Implementation | 3 | ** Internal Module for Debugging of the Lua Implementation |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -356,7 +356,9 @@ static int newuserdata (lua_State *L) { | |||
356 | return 2; | 356 | return 2; |
357 | } | 357 | } |
358 | else { | 358 | else { |
359 | lua_newuserdata(L, luaL_check_int(L, 1)); | 359 | size_t size = luaL_check_int(L, 1); |
360 | char *p = (char *)lua_newuserdata(L, size); | ||
361 | while (size--) *p++ = '\0'; | ||
360 | return 1; | 362 | return 1; |
361 | } | 363 | } |
362 | } | 364 | } |