mirror of
https://github.com/bjc/prosody.git
synced 2025-04-01 20:27:39 +03:00
parent
2ec8fbe7e5
commit
dff4beae02
12 changed files with 2 additions and 56 deletions
|
@ -124,9 +124,7 @@ static int Lrandom(lua_State *L) {
|
|||
}
|
||||
|
||||
int luaopen_util_crand(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, Lrandom);
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
#if (LUA_VERSION_NUM < 504)
|
||||
#define luaL_pushfail lua_pushnil
|
||||
#endif
|
||||
|
@ -616,9 +613,7 @@ static const luaL_Reg Reg_idna[] = {
|
|||
/***************** end *****************/
|
||||
|
||||
LUALIB_API int luaopen_util_encodings(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
#ifdef USE_STRINGPREP_ICU
|
||||
init_icu();
|
||||
#endif
|
||||
|
|
|
@ -30,9 +30,6 @@ typedef unsigned __int32 uint32_t;
|
|||
#include <openssl/evp.h>
|
||||
#include <openssl/err.h>
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
|
||||
static const char *hex_tab = "0123456789abcdef";
|
||||
static void toHex(const unsigned char *in, int length, unsigned char *out) {
|
||||
|
@ -258,9 +255,7 @@ static const luaL_Reg Reg[] = {
|
|||
};
|
||||
|
||||
LUALIB_API int luaopen_util_hashes(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
lua_newtable(L);
|
||||
luaL_setfuncs(L, Reg, 0);
|
||||
lua_pushliteral(L, "-3.14");
|
||||
|
|
|
@ -30,9 +30,6 @@
|
|||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
#if (LUA_VERSION_NUM < 504)
|
||||
#define luaL_pushfail lua_pushnil
|
||||
#endif
|
||||
|
@ -193,9 +190,7 @@ static int lc_ntop(lua_State *L) {
|
|||
}
|
||||
|
||||
int luaopen_util_net(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
luaL_Reg exports[] = {
|
||||
{ "local_addresses", lc_local_addresses },
|
||||
{ "pton", lc_pton },
|
||||
|
|
|
@ -44,9 +44,6 @@
|
|||
|
||||
#define STATE_MT "util.poll<" POLL_BACKEND ">"
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setmetatable(L, tname) luaL_getmetatable(L, tname); lua_setmetatable(L, -2)
|
||||
#endif
|
||||
#if (LUA_VERSION_NUM < 504)
|
||||
#define luaL_pushfail lua_pushnil
|
||||
#endif
|
||||
|
@ -564,9 +561,7 @@ static int Lnew(lua_State *L) {
|
|||
* Open library
|
||||
*/
|
||||
int luaopen_util_poll(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
|
||||
luaL_newmetatable(L, STATE_MT);
|
||||
{
|
||||
|
|
|
@ -58,9 +58,6 @@
|
|||
#include "lualib.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
#if (LUA_VERSION_NUM < 503)
|
||||
#define lua_isinteger(L, n) lua_isnumber(L, n)
|
||||
#endif
|
||||
|
@ -829,9 +826,7 @@ static int lc_isatty(lua_State *L) {
|
|||
/* Register functions */
|
||||
|
||||
int luaopen_util_pposix(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
luaL_Reg exports[] = {
|
||||
{ "abort", lc_abort },
|
||||
|
||||
|
|
|
@ -314,9 +314,7 @@ static int rb_new(lua_State *L) {
|
|||
}
|
||||
|
||||
int luaopen_util_ringbuffer(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
|
||||
if(luaL_newmetatable(L, "ringbuffer_mt")) {
|
||||
lua_pushcfunction(L, rb_tostring);
|
||||
|
|
|
@ -36,9 +36,6 @@
|
|||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
#if (LUA_VERSION_NUM < 503)
|
||||
#define lua_isinteger(L, n) lua_isnumber(L, n)
|
||||
#endif
|
||||
|
@ -381,9 +378,7 @@ static const struct luaL_Reg lsignal_lib[] = {
|
|||
};
|
||||
|
||||
int luaopen_util_signal(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
int i = 0;
|
||||
|
||||
/* add the library */
|
||||
|
|
|
@ -8,9 +8,6 @@
|
|||
#include <lua.h>
|
||||
#include <lauxlib.h>
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
|
||||
/* TODO Deduplicate code somehow */
|
||||
|
||||
|
|
|
@ -36,12 +36,6 @@
|
|||
#include "lauxlib.h"
|
||||
|
||||
|
||||
#if (LUA_VERSION_NUM >= 502)
|
||||
|
||||
#define luaL_register(L,n,f) luaL_newlib(L,f)
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* basic integer type */
|
||||
#if !defined(STRUCT_INT)
|
||||
|
@ -392,7 +386,7 @@ static const struct luaL_Reg thislib[] = {
|
|||
LUALIB_API int luaopen_util_struct (lua_State *L);
|
||||
|
||||
LUALIB_API int luaopen_util_struct (lua_State *L) {
|
||||
luaL_register(L, "struct", thislib);
|
||||
luaL_newlib(L, thislib);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,10 +6,6 @@
|
|||
#define LUA_MAXINTEGER PTRDIFF_MAX
|
||||
#endif
|
||||
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
#define lua_equal(L, A, B) lua_compare(L, A, B, LUA_OPEQ)
|
||||
#endif
|
||||
|
||||
static int Lcreate_table(lua_State *L) {
|
||||
lua_createtable(L, luaL_checkinteger(L, 1), luaL_checkinteger(L, 2));
|
||||
return 1;
|
||||
|
@ -47,7 +43,7 @@ static int Lmove (lua_State *L) {
|
|||
n = e - f + 1; /* number of elements to move */
|
||||
luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4,
|
||||
"destination wrap around");
|
||||
if (t > e || t <= f || (tt != 1 && !lua_equal(L, 1, tt))) {
|
||||
if (t > e || t <= f || (tt != 1 && !lua_compare(L, 1, tt, LUA_OPEQ))) {
|
||||
for (i = 0; i < n; i++) {
|
||||
lua_rawgeti(L, 1, f + i);
|
||||
lua_rawseti(L, tt, t + i);
|
||||
|
@ -65,9 +61,7 @@ static int Lmove (lua_State *L) {
|
|||
}
|
||||
|
||||
int luaopen_util_table(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
lua_createtable(L, 0, 2);
|
||||
lua_pushcfunction(L, Lcreate_table);
|
||||
lua_setfield(L, -2, "create");
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
#include "lua.h"
|
||||
#include "lauxlib.h"
|
||||
|
||||
#if (LUA_VERSION_NUM == 501)
|
||||
#define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R)
|
||||
#endif
|
||||
#if (LUA_VERSION_NUM < 504)
|
||||
#define luaL_pushfail lua_pushnil
|
||||
#endif
|
||||
|
@ -106,9 +103,7 @@ static const luaL_Reg Reg[] = {
|
|||
};
|
||||
|
||||
LUALIB_API int luaopen_util_windows(lua_State *L) {
|
||||
#if (LUA_VERSION_NUM > 501)
|
||||
luaL_checkversion(L);
|
||||
#endif
|
||||
lua_newtable(L);
|
||||
luaL_setfuncs(L, Reg, 0);
|
||||
lua_pushliteral(L, "-3.14");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue