util: Add compat for prosody module name change to C sources

This commit is contained in:
Kim Alvefur 2023-03-17 18:03:07 +01:00
parent 43531740f9
commit 8136aa749a
14 changed files with 64 additions and 14 deletions

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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);
}

View file

@ -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.

View file

@ -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);
}

View file

@ -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);
}