diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-01 11:56:49 -0200 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2001-02-01 11:56:49 -0200 |
commit | 68587639945aa68844871fdd74a6729b653f523a (patch) | |
tree | cc0efe84ea56f5b03d176768a9771b57bcb5c154 | |
parent | b68fb7f62e1475e28a4cb27569e8b659f925e114 (diff) | |
download | lua-68587639945aa68844871fdd74a6729b653f523a.tar.gz lua-68587639945aa68844871fdd74a6729b653f523a.tar.bz2 lua-68587639945aa68844871fdd74a6729b653f523a.zip |
bug in lua_pushuserdata(L, NULL)
-rw-r--r-- | bugs | 5 | ||||
-rw-r--r-- | lapi.c | 3 | ||||
-rw-r--r-- | lstring.c | 4 |
3 files changed, 9 insertions, 3 deletions
@@ -250,3 +250,8 @@ Fri Dec 22 15:30:42 EDT 2000 | |||
250 | >> when `read' fails it must return nil (and not no value) | 250 | >> when `read' fails it must return nil (and not no value) |
251 | (by cassino; since at least 3.1) | 251 | (by cassino; since at least 3.1) |
252 | 252 | ||
253 | ** lstring.c/lapi.c | ||
254 | Thu Feb 1 11:55:45 EDT 2001 | ||
255 | >> lua_pushuserdata(L, NULL) is buggy | ||
256 | (by Edgar Toernig; since 4.0) | ||
257 | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lapi.c,v 1.121 2001/01/26 11:45:51 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 1.122 2001/01/29 17:16:58 roberto Exp roberto $ |
3 | ** Lua API | 3 | ** Lua API |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -702,6 +702,7 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) { | |||
702 | TString *ts; | 702 | TString *ts; |
703 | void *p; | 703 | void *p; |
704 | LUA_LOCK; | 704 | LUA_LOCK; |
705 | if (size == 0) size = 1; | ||
705 | ts = luaS_newudata(L, size, NULL); | 706 | ts = luaS_newudata(L, size, NULL); |
706 | setuvalue(L->top, ts); | 707 | setuvalue(L->top, ts); |
707 | api_incr_top(L); | 708 | api_incr_top(L); |
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstring.c,v 1.52 2001/01/26 15:58:50 roberto Exp roberto $ | 2 | ** $Id: lstring.c,v 1.53 2001/01/29 19:34:02 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 | */ |
@@ -97,7 +97,7 @@ TString *luaS_newudata (lua_State *L, size_t s, void *udata) { | |||
97 | ts->nexthash = NULL; | 97 | ts->nexthash = NULL; |
98 | ts->len = s; | 98 | ts->len = s; |
99 | ts->u.d.tag = 0; | 99 | ts->u.d.tag = 0; |
100 | ts->u.d.value = (udata == NULL) ? uts+1 : udata; | 100 | ts->u.d.value = (s > 0) ? uts+1 : udata; |
101 | /* insert it on table */ | 101 | /* insert it on table */ |
102 | newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size)); | 102 | newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size)); |
103 | return ts; | 103 | return ts; |