Software /
code /
prosody
Comparison
util-src/hashes.c @ 6789:6b180e77c97a
util-src/*.c: Invert Lua 5.2 compat to be 5.2+ by default and a macro to support 5.1
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 26 Apr 2015 12:38:37 +0200 |
parent | 6620:50eaefeec013 |
child | 7818:54669df178c2 |
comparison
equal
deleted
inserted
replaced
6788:d64c1f3c7e2e | 6789:6b180e77c97a |
---|---|
25 #include "lua.h" | 25 #include "lua.h" |
26 #include "lauxlib.h" | 26 #include "lauxlib.h" |
27 #include <openssl/sha.h> | 27 #include <openssl/sha.h> |
28 #include <openssl/md5.h> | 28 #include <openssl/md5.h> |
29 | 29 |
30 #if (LUA_VERSION_NUM == 502) | 30 #if (LUA_VERSION_NUM == 501) |
31 #define luaL_register(L, N, R) luaL_setfuncs(L, R, 0) | 31 #define luaL_setfuncs(L, R, N) luaL_register(L, NULL, R) |
32 #endif | 32 #endif |
33 | 33 |
34 #define HMAC_IPAD 0x36363636 | 34 #define HMAC_IPAD 0x36363636 |
35 #define HMAC_OPAD 0x5c5c5c5c | 35 #define HMAC_OPAD 0x5c5c5c5c |
36 | 36 |
211 { NULL, NULL } | 211 { NULL, NULL } |
212 }; | 212 }; |
213 | 213 |
214 LUALIB_API int luaopen_util_hashes(lua_State* L) { | 214 LUALIB_API int luaopen_util_hashes(lua_State* L) { |
215 lua_newtable(L); | 215 lua_newtable(L); |
216 luaL_register(L, NULL, Reg); | 216 luaL_setfuncs(L, Reg, 0);; |
217 lua_pushliteral(L, "-3.14"); | 217 lua_pushliteral(L, "-3.14"); |
218 lua_setfield(L, -2, "version"); | 218 lua_setfield(L, -2, "version"); |
219 return 1; | 219 return 1; |
220 } | 220 } |