no more 'luaO_nilobject' to avoid comparison of global variable addresses

(now uses static variables)
This commit is contained in:
Roberto Ierusalimschy
2018-06-01 14:40:38 -03:00
parent fb8fa66136
commit 505fc91222
5 changed files with 12 additions and 20 deletions

View File

@@ -1,5 +1,5 @@
/*
** $Id: lstate.c,v 2.151 2018/02/05 17:11:37 roberto Exp roberto $
** $Id: lstate.c,v 2.152 2018/05/29 18:02:51 roberto Exp roberto $
** Global State
** See Copyright Notice in lua.h
*/
@@ -69,12 +69,11 @@ typedef struct LG {
memcpy(b + p, &t, sizeof(t)); p += sizeof(t); }
static unsigned int luai_makeseed (lua_State *L) {
char buff[4 * sizeof(size_t)];
char buff[3 * sizeof(size_t)];
unsigned int h = cast_uint(time(NULL));
int p = 0;
addbuff(buff, p, L); /* heap variable */
addbuff(buff, p, &h); /* local variable */
addbuff(buff, p, luaO_nilobject); /* global variable */
addbuff(buff, p, &lua_newstate); /* public function */
lua_assert(p == sizeof(buff));
return luaS_hash(buff, p, h);