diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-15 10:28:32 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-15 10:28:32 -0300 |
commit | 25cd3d377ec13176a6701d9d21a278ba8f2bc3d6 (patch) | |
tree | db4d9d08f79599f0fdfafec166ff4390a195dedc /ltests.c | |
parent | 1028f296a8e6477cb556c75fe1397cd4e2762abe (diff) | |
download | lua-25cd3d377ec13176a6701d9d21a278ba8f2bc3d6.tar.gz lua-25cd3d377ec13176a6701d9d21a278ba8f2bc3d6.tar.bz2 lua-25cd3d377ec13176a6701d9d21a278ba8f2bc3d6.zip |
Buffer in 'luai_makeseed' measured in bytes
In the (rare) cases when sizeof(void*) or sizeof(time_t) are not
multiples of sizeof(int), we still can use all their bytes in the seed.
Diffstat (limited to 'ltests.c')
-rw-r--r-- | ltests.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -1160,6 +1160,12 @@ static int num2int (lua_State *L) { | |||
1160 | } | 1160 | } |
1161 | 1161 | ||
1162 | 1162 | ||
1163 | static int makeseed (lua_State *L) { | ||
1164 | lua_pushinteger(L, luaL_makeseed(L)); | ||
1165 | return 1; | ||
1166 | } | ||
1167 | |||
1168 | |||
1163 | static int newstate (lua_State *L) { | 1169 | static int newstate (lua_State *L) { |
1164 | void *ud; | 1170 | void *ud; |
1165 | lua_Alloc f = lua_getallocf(L, &ud); | 1171 | lua_Alloc f = lua_getallocf(L, &ud); |
@@ -1962,6 +1968,7 @@ static const struct luaL_Reg tests_funcs[] = { | |||
1962 | {"newstate", newstate}, | 1968 | {"newstate", newstate}, |
1963 | {"newuserdata", newuserdata}, | 1969 | {"newuserdata", newuserdata}, |
1964 | {"num2int", num2int}, | 1970 | {"num2int", num2int}, |
1971 | {"makeseed", makeseed}, | ||
1965 | {"pushuserdata", pushuserdata}, | 1972 | {"pushuserdata", pushuserdata}, |
1966 | {"querystr", string_query}, | 1973 | {"querystr", string_query}, |
1967 | {"querytab", table_query}, | 1974 | {"querytab", table_query}, |