Commit 1355fae7 authored by neoxic's avatar neoxic
Browse files

Brush up public/private decls

Use fixed literal for luaL_register()
parent 803a24ed
...@@ -22,14 +22,6 @@ ...@@ -22,14 +22,6 @@
#include "json.h" #include "json.h"
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __attribute__((visibility("default")))
#endif
EXPORT int luaopen_json(lua_State *L);
static const luaL_Reg funcs[] = { static const luaL_Reg funcs[] = {
{"encode", json__encode}, {"encode", json__encode},
{"decode", json__decode}, {"decode", json__decode},
...@@ -38,7 +30,7 @@ static const luaL_Reg funcs[] = { ...@@ -38,7 +30,7 @@ static const luaL_Reg funcs[] = {
int luaopen_json(lua_State *L) { int luaopen_json(lua_State *L) {
#if LUA_VERSION_NUM < 502 #if LUA_VERSION_NUM < 502
luaL_register(L, lua_tostring(L, 1), funcs); luaL_register(L, "json", funcs);
#else #else
luaL_newlib(L, funcs); luaL_newlib(L, funcs);
#endif #endif
......
...@@ -24,10 +24,6 @@ ...@@ -24,10 +24,6 @@
#include <lauxlib.h> #include <lauxlib.h>
#ifndef _WIN32
#pragma GCC visibility push(hidden)
#endif
#define MODNAME "lua-json" #define MODNAME "lua-json"
#define VERSION "0.1.3" #define VERSION "0.1.3"
...@@ -37,6 +33,18 @@ ...@@ -37,6 +33,18 @@
#define lua_rawlen(L, idx) lua_objlen(L, idx) #define lua_rawlen(L, idx) lua_objlen(L, idx)
#endif #endif
#ifdef _WIN32
#define EXPORT __declspec(dllexport)
#else
#define EXPORT __attribute__((visibility("default")))
#endif
EXPORT int luaopen_json(lua_State *L);
#ifndef _WIN32
#pragma GCC visibility push(hidden)
#endif
int json__encode(lua_State *L); int json__encode(lua_State *L);
int json__decode(lua_State *L); int json__decode(lua_State *L);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment