Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Lua Json
Commits
1355fae7
Commit
1355fae7
authored
Oct 19, 2020
by
neoxic
Browse files
Brush up public/private decls
Use fixed literal for luaL_register()
parent
803a24ed
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/json.c
View file @
1355fae7
...
@@ -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
...
...
src/json.h
View file @
1355fae7
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment