diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-01 14:40:38 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-01 14:40:38 -0300 |
commit | 505fc9122255b8a2ef761720bca21fd5e9be8e73 (patch) | |
tree | cf3fe8068546547e7f53e86e16a32ee923a4c514 /lstate.c | |
parent | fb8fa661366e15e98c60d8929feaab9e551a02f9 (diff) | |
download | lua-505fc9122255b8a2ef761720bca21fd5e9be8e73.tar.gz lua-505fc9122255b8a2ef761720bca21fd5e9be8e73.tar.bz2 lua-505fc9122255b8a2ef761720bca21fd5e9be8e73.zip |
no more 'luaO_nilobject' to avoid comparison of global variable addresses
(now uses static variables)
Diffstat (limited to 'lstate.c')
-rw-r--r-- | lstate.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.151 2018/02/05 17:11:37 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.152 2018/05/29 18:02:51 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -69,12 +69,11 @@ typedef struct LG { | |||
69 | memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } | 69 | memcpy(b + p, &t, sizeof(t)); p += sizeof(t); } |
70 | 70 | ||
71 | static unsigned int luai_makeseed (lua_State *L) { | 71 | static unsigned int luai_makeseed (lua_State *L) { |
72 | char buff[4 * sizeof(size_t)]; | 72 | char buff[3 * sizeof(size_t)]; |
73 | unsigned int h = cast_uint(time(NULL)); | 73 | unsigned int h = cast_uint(time(NULL)); |
74 | int p = 0; | 74 | int p = 0; |
75 | addbuff(buff, p, L); /* heap variable */ | 75 | addbuff(buff, p, L); /* heap variable */ |
76 | addbuff(buff, p, &h); /* local variable */ | 76 | addbuff(buff, p, &h); /* local variable */ |
77 | addbuff(buff, p, luaO_nilobject); /* global variable */ | ||
78 | addbuff(buff, p, &lua_newstate); /* public function */ | 77 | addbuff(buff, p, &lua_newstate); /* public function */ |
79 | lua_assert(p == sizeof(buff)); | 78 | lua_assert(p == sizeof(buff)); |
80 | return luaS_hash(buff, p, h); | 79 | return luaS_hash(buff, p, h); |