aboutsummaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-06-01 14:40:38 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2018-06-01 14:40:38 -0300
commit505fc9122255b8a2ef761720bca21fd5e9be8e73 (patch)
treecf3fe8068546547e7f53e86e16a32ee923a4c514 /lstate.c
parentfb8fa661366e15e98c60d8929feaab9e551a02f9 (diff)
downloadlua-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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/lstate.c b/lstate.c
index 5a2c3577..2622a1d9 100644
--- a/lstate.c
+++ b/lstate.c
@@ -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
71static unsigned int luai_makeseed (lua_State *L) { 71static 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);