compat: pragma visibility

This commit is contained in:
E. Westbrook 2019-02-27 20:56:48 -07:00
parent e3ac49efbd
commit 133774cd3d
2 changed files with 14 additions and 9 deletions

View File

@ -2,10 +2,11 @@
#include "compat.h"
#if LUA_VERSION_NUM==501
/*
** Adapted from Lua 5.2
*/
LUASOCKET_PRIVATE void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup) {
luaL_checkstack(L, nup+1, "too many upvalues");
for (; l->name != NULL; l++) { /* fill the table with given functions */
int i;
@ -21,7 +22,7 @@ LUASOCKET_PRIVATE void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup)
/*
** Duplicated from Lua 5.2
*/
LUASOCKET_PRIVATE void *luaL_testudata (lua_State *L, int ud, const char *tname) {
void *luasocket_testudata (lua_State *L, int ud, const char *tname) {
void *p = lua_touserdata(L, ud);
if (p != NULL) { /* value is a userdata? */
if (lua_getmetatable(L, ud)) { /* does it have a metatable? */

View File

@ -1,14 +1,18 @@
#ifndef COMPAT_H
#define COMPAT_H
#include "lua.h"
#include "lauxlib.h"
#if LUA_VERSION_NUM==501
#define luaL_setfuncs socket_setfuncs
#define luaL_testudata socket_testudata
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
void *luaL_testudata ( lua_State *L, int arg, const char *tname);
#pragma GCC visibility push(hidden)
void luasocket_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
void *luasocket_testudata ( lua_State *L, int arg, const char *tname);
#pragma GCC visibility pop
#define luaL_setfuncs luasocket_setfuncs
#define luaL_testudata luasocket_testudata
#endif
#endif