mirror of https://github.com/rusefi/lua.git
bug in lua_pushuserdata(L, NULL)
This commit is contained in:
parent
b68fb7f62e
commit
6858763994
5
bugs
5
bugs
|
@ -250,3 +250,8 @@ Fri Dec 22 15:30:42 EDT 2000
|
||||||
>> when `read' fails it must return nil (and not no value)
|
>> when `read' fails it must return nil (and not no value)
|
||||||
(by cassino; since at least 3.1)
|
(by cassino; since at least 3.1)
|
||||||
|
|
||||||
|
** lstring.c/lapi.c
|
||||||
|
Thu Feb 1 11:55:45 EDT 2001
|
||||||
|
>> lua_pushuserdata(L, NULL) is buggy
|
||||||
|
(by Edgar Toernig; since 4.0)
|
||||||
|
|
||||||
|
|
3
lapi.c
3
lapi.c
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lapi.c,v 1.121 2001/01/26 11:45:51 roberto Exp roberto $
|
** $Id: lapi.c,v 1.122 2001/01/29 17:16:58 roberto Exp roberto $
|
||||||
** Lua API
|
** Lua API
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -702,6 +702,7 @@ LUA_API void *lua_newuserdata (lua_State *L, size_t size) {
|
||||||
TString *ts;
|
TString *ts;
|
||||||
void *p;
|
void *p;
|
||||||
LUA_LOCK;
|
LUA_LOCK;
|
||||||
|
if (size == 0) size = 1;
|
||||||
ts = luaS_newudata(L, size, NULL);
|
ts = luaS_newudata(L, size, NULL);
|
||||||
setuvalue(L->top, ts);
|
setuvalue(L->top, ts);
|
||||||
api_incr_top(L);
|
api_incr_top(L);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
** $Id: lstring.c,v 1.52 2001/01/26 15:58:50 roberto Exp roberto $
|
** $Id: lstring.c,v 1.53 2001/01/29 19:34:02 roberto Exp roberto $
|
||||||
** String table (keeps all strings handled by Lua)
|
** String table (keeps all strings handled by Lua)
|
||||||
** See Copyright Notice in lua.h
|
** See Copyright Notice in lua.h
|
||||||
*/
|
*/
|
||||||
|
@ -97,7 +97,7 @@ TString *luaS_newudata (lua_State *L, size_t s, void *udata) {
|
||||||
ts->nexthash = NULL;
|
ts->nexthash = NULL;
|
||||||
ts->len = s;
|
ts->len = s;
|
||||||
ts->u.d.tag = 0;
|
ts->u.d.tag = 0;
|
||||||
ts->u.d.value = (udata == NULL) ? uts+1 : udata;
|
ts->u.d.value = (s > 0) ? uts+1 : udata;
|
||||||
/* insert it on table */
|
/* insert it on table */
|
||||||
newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size));
|
newentry(L, &G(L)->udt, ts, lmod(IntPoint(ts->u.d.value), G(L)->udt.size));
|
||||||
return ts;
|
return ts;
|
||||||
|
|
Loading…
Reference in New Issue