aboutsummaryrefslogtreecommitdiffstats
path: root/util-src/crand.c
diff options
context:
space:
mode:
Diffstat (limited to 'util-src/crand.c')
-rw-r--r--util-src/crand.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/util-src/crand.c b/util-src/crand.c
index 160ac1f6..6f17c162 100644
--- a/util-src/crand.c
+++ b/util-src/crand.c
@@ -45,7 +45,7 @@
#endif
/* This wasn't present before glibc 2.25 */
-int getrandom(void *buf, size_t buflen, unsigned int flags) {
+static int getrandom(void *buf, size_t buflen, unsigned int flags) {
return syscall(SYS_getrandom, buf, buflen, flags);
}
#else
@@ -66,7 +66,7 @@ int getrandom(void *buf, size_t buflen, unsigned int flags) {
#define SMALLBUFSIZ 32
#endif
-int Lrandom(lua_State *L) {
+static int Lrandom(lua_State *L) {
char smallbuf[SMALLBUFSIZ];
char *buf = &smallbuf[0];
const lua_Integer l = luaL_checkinteger(L, 1);
@@ -123,10 +123,8 @@ int Lrandom(lua_State *L) {
return 1;
}
-int luaopen_util_crand(lua_State *L) {
-#if (LUA_VERSION_NUM > 501)
+int luaopen_prosody_util_crand(lua_State *L) {
luaL_checkversion(L);
-#endif
lua_createtable(L, 0, 2);
lua_pushcfunction(L, Lrandom);
@@ -144,3 +142,6 @@ int luaopen_util_crand(lua_State *L) {
return 1;
}
+int luaopen_util_crand(lua_State *L) {
+ return luaopen_prosody_util_crand(L);
+}