From 8136aa749a76e4fbb5b7e3cc34c878733647b8e9 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 17 Mar 2023 18:03:07 +0100 Subject: util: Add compat for prosody module name change to C sources --- util-src/compat.c | 6 +++++- util-src/crand.c | 5 ++++- util-src/crypto.c | 6 +++++- util-src/encodings.c | 5 ++++- util-src/hashes.c | 5 ++++- util-src/net.c | 5 ++++- util-src/poll.c | 7 ++++++- util-src/pposix.c | 5 ++++- util-src/ringbuffer.c | 6 +++++- util-src/signal.c | 5 ++++- util-src/strbitop.c | 6 +++++- util-src/struct.c | 6 +++++- util-src/table.c | 6 +++++- util-src/time.c | 5 ++++- 14 files changed, 64 insertions(+), 14 deletions(-) diff --git a/util-src/compat.c b/util-src/compat.c index 34b35c35..3918bf3e 100644 --- a/util-src/compat.c +++ b/util-src/compat.c @@ -19,7 +19,7 @@ static int lc_xpcall (lua_State *L) { return lua_gettop(L); } -int luaopen_util_compat(lua_State *L) { +int luaopen_prosody_util_compat(lua_State *L) { lua_createtable(L, 0, 2); { lua_pushcfunction(L, lc_xpcall); @@ -27,3 +27,7 @@ int luaopen_util_compat(lua_State *L) { } return 1; } + +int luaopen_util_compat(lua_State *L) { + return luaopen_prosody_util_compat(L); +} diff --git a/util-src/crand.c b/util-src/crand.c index c6f0a3ba..6f17c162 100644 --- a/util-src/crand.c +++ b/util-src/crand.c @@ -123,7 +123,7 @@ static int Lrandom(lua_State *L) { return 1; } -int luaopen_util_crand(lua_State *L) { +int luaopen_prosody_util_crand(lua_State *L) { luaL_checkversion(L); lua_createtable(L, 0, 2); @@ -142,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); +} diff --git a/util-src/crypto.c b/util-src/crypto.c index d2427503..1e69599d 100644 --- a/util-src/crypto.c +++ b/util-src/crypto.c @@ -592,7 +592,7 @@ static const luaL_Reg KeyMetatable[] = { { NULL, NULL } }; -LUALIB_API int luaopen_util_crypto(lua_State *L) { +LUALIB_API int luaopen_prosody_util_crypto(lua_State *L) { #if (LUA_VERSION_NUM > 501) luaL_checkversion(L); #endif @@ -616,3 +616,7 @@ LUALIB_API int luaopen_util_crypto(lua_State *L) { #endif return 1; } + +LUALIB_API int luaopen_util_crypto(lua_State *L) { + return luaopen_prosody_util_crypto(L); +} diff --git a/util-src/encodings.c b/util-src/encodings.c index 157d8526..ca2eb8b6 100644 --- a/util-src/encodings.c +++ b/util-src/encodings.c @@ -612,7 +612,7 @@ static const luaL_Reg Reg_idna[] = { /***************** end *****************/ -LUALIB_API int luaopen_util_encodings(lua_State *L) { +LUALIB_API int luaopen_prosody_util_encodings(lua_State *L) { luaL_checkversion(L); #ifdef USE_STRINGPREP_ICU init_icu(); @@ -646,3 +646,6 @@ LUALIB_API int luaopen_util_encodings(lua_State *L) { lua_setfield(L, -2, "version"); return 1; } +LUALIB_API int luaopen_util_encodings(lua_State *L) { + return luaopen_prosody_util_encodings(L); +} diff --git a/util-src/hashes.c b/util-src/hashes.c index 94f8bcb2..3c2b16a7 100644 --- a/util-src/hashes.c +++ b/util-src/hashes.c @@ -313,7 +313,7 @@ static const luaL_Reg Reg[] = { { NULL, NULL } }; -LUALIB_API int luaopen_util_hashes(lua_State *L) { +LUALIB_API int luaopen_prosody_util_hashes(lua_State *L) { luaL_checkversion(L); lua_newtable(L); luaL_setfuncs(L, Reg, 0); @@ -325,3 +325,6 @@ LUALIB_API int luaopen_util_hashes(lua_State *L) { #endif return 1; } +LUALIB_API int luaopen_util_hashes(lua_State *L) { + return luaopen_prosody_util_hashes(L); +} diff --git a/util-src/net.c b/util-src/net.c index 96b50e7b..1a84c882 100644 --- a/util-src/net.c +++ b/util-src/net.c @@ -189,7 +189,7 @@ static int lc_ntop(lua_State *L) { return 1; } -int luaopen_util_net(lua_State *L) { +int luaopen_prosody_util_net(lua_State *L) { luaL_checkversion(L); luaL_Reg exports[] = { { "local_addresses", lc_local_addresses }, @@ -202,3 +202,6 @@ int luaopen_util_net(lua_State *L) { luaL_setfuncs(L, exports, 0); return 1; } +int luaopen_util_net(lua_State *L) { + return luaopen_prosody_util_net(L); +} diff --git a/util-src/poll.c b/util-src/poll.c index 7ea2e140..6ec9ae35 100644 --- a/util-src/poll.c +++ b/util-src/poll.c @@ -560,7 +560,7 @@ static int Lnew(lua_State *L) { /* * Open library */ -int luaopen_util_poll(lua_State *L) { +int luaopen_prosody_util_poll(lua_State *L) { luaL_checkversion(L); luaL_newmetatable(L, STATE_MT); @@ -614,3 +614,8 @@ int luaopen_util_poll(lua_State *L) { return 1; } +/* COMPAT */ +int luaopen_util_poll(lua_State *L) { + return luaopen_prosody_util_poll(L); +} + diff --git a/util-src/pposix.c b/util-src/pposix.c index aac27d35..d5a6712e 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -825,7 +825,7 @@ static int lc_isatty(lua_State *L) { /* Register functions */ -int luaopen_util_pposix(lua_State *L) { +int luaopen_prosody_util_pposix(lua_State *L) { luaL_checkversion(L); luaL_Reg exports[] = { { "abort", lc_abort }, @@ -883,3 +883,6 @@ int luaopen_util_pposix(lua_State *L) { return 1; } +int luaopen_util_pposix(lua_State *L) { + return luaopen_prosody_util_pposix(L); +} diff --git a/util-src/ringbuffer.c b/util-src/ringbuffer.c index 95c62de9..43846142 100644 --- a/util-src/ringbuffer.c +++ b/util-src/ringbuffer.c @@ -313,7 +313,7 @@ static int rb_new(lua_State *L) { return 1; } -int luaopen_util_ringbuffer(lua_State *L) { +int luaopen_prosody_util_ringbuffer(lua_State *L) { luaL_checkversion(L); if(luaL_newmetatable(L, "ringbuffer_mt")) { @@ -353,3 +353,7 @@ int luaopen_util_ringbuffer(lua_State *L) { lua_setfield(L, -2, "new"); return 1; } + +int luaopen_util_ringbuffer(lua_State *L) { + return luaopen_prosody_util_ringbuffer(L); +} diff --git a/util-src/signal.c b/util-src/signal.c index b5ba16a9..a55b6f87 100644 --- a/util-src/signal.c +++ b/util-src/signal.c @@ -377,7 +377,7 @@ static const struct luaL_Reg lsignal_lib[] = { {NULL, NULL} }; -int luaopen_util_signal(lua_State *L) { +int luaopen_prosody_util_signal(lua_State *L) { luaL_checkversion(L); int i = 0; @@ -408,3 +408,6 @@ int luaopen_util_signal(lua_State *L) { return 1; } +int luaopen_util_signal(lua_State *L) { + return luaopen_prosody_util_signal(L); +} diff --git a/util-src/strbitop.c b/util-src/strbitop.c index 722f5a2d..75cfea81 100644 --- a/util-src/strbitop.c +++ b/util-src/strbitop.c @@ -74,7 +74,7 @@ static int strop_xor(lua_State *L) { return 1; } -LUA_API int luaopen_util_strbitop(lua_State *L) { +LUA_API int luaopen_prosody_util_strbitop(lua_State *L) { luaL_Reg exports[] = { { "sand", strop_and }, { "sor", strop_or }, @@ -86,3 +86,7 @@ LUA_API int luaopen_util_strbitop(lua_State *L) { luaL_setfuncs(L, exports, 0); return 1; } + +LUA_API int luaopen_util_strbitop(lua_State *L) { + return luaopen_prosody_util_strbitop(L); +} diff --git a/util-src/struct.c b/util-src/struct.c index b236db5b..a779f53e 100644 --- a/util-src/struct.c +++ b/util-src/struct.c @@ -385,11 +385,15 @@ static const struct luaL_Reg thislib[] = { LUALIB_API int luaopen_util_struct (lua_State *L); -LUALIB_API int luaopen_util_struct (lua_State *L) { +LUALIB_API int luaopen_prosody_util_struct (lua_State *L) { luaL_newlib(L, thislib); return 1; } +LUALIB_API int luaopen_util_struct (lua_State *L) { + return luaopen_prosody_util_struct(L); +} + /****************************************************************************** * Copyright (C) 2010-2018 Lua.org, PUC-Rio. All rights reserved. diff --git a/util-src/table.c b/util-src/table.c index 1cbb276d..7e01c072 100644 --- a/util-src/table.c +++ b/util-src/table.c @@ -60,7 +60,7 @@ static int Lmove (lua_State *L) { return 1; } -int luaopen_util_table(lua_State *L) { +int luaopen_prosody_util_table(lua_State *L) { luaL_checkversion(L); lua_createtable(L, 0, 2); lua_pushcfunction(L, Lcreate_table); @@ -71,3 +71,7 @@ int luaopen_util_table(lua_State *L) { lua_setfield(L, -2, "move"); return 1; } + +int luaopen_util_table(lua_State *L) { + return luaopen_prosody_util_table(L); +} diff --git a/util-src/time.c b/util-src/time.c index afef3df5..e5e72a09 100644 --- a/util-src/time.c +++ b/util-src/time.c @@ -23,7 +23,7 @@ static int lc_time_monotonic(lua_State *L) { return 1; } -int luaopen_util_time(lua_State *L) { +int luaopen_prosody_util_time(lua_State *L) { lua_createtable(L, 0, 2); { lua_pushcfunction(L, lc_time_realtime); @@ -33,3 +33,6 @@ int luaopen_util_time(lua_State *L) { } return 1; } +int luaopen_util_time(lua_State *L) { + return luaopen_prosody_util_time(L); +} -- cgit v1.2.3