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
803a24ed
Commit
803a24ed
authored
Oct 19, 2020
by
neoxic
Browse files
Cosmetics
parent
c1bf82be
Changes
1
Show whitespace changes
Inline
Side-by-side
src/json-encode.c
View file @
803a24ed
...
@@ -42,7 +42,7 @@ static char *resizeBox(lua_State *L, Box *box, size_t size) {
...
@@ -42,7 +42,7 @@ static char *resizeBox(lua_State *L, Box *box, size_t size) {
return
buf
;
return
buf
;
}
}
static
int
m__gc
(
lua_State
*
L
)
{
static
int
freeBox
(
lua_State
*
L
)
{
resizeBox
(
L
,
lua_touserdata
(
L
,
1
),
0
);
resizeBox
(
L
,
lua_touserdata
(
L
,
1
),
0
);
return
0
;
return
0
;
}
}
...
@@ -53,7 +53,7 @@ static Box *newBox(lua_State *L) {
...
@@ -53,7 +53,7 @@ static Box *newBox(lua_State *L) {
box
->
pos
=
0
;
box
->
pos
=
0
;
box
->
size
=
0
;
box
->
size
=
0
;
if
(
luaL_newmetatable
(
L
,
MODNAME
))
{
if
(
luaL_newmetatable
(
L
,
MODNAME
))
{
lua_pushcfunction
(
L
,
m__gc
);
lua_pushcfunction
(
L
,
freeBox
);
lua_setfield
(
L
,
-
2
,
"__gc"
);
lua_setfield
(
L
,
-
2
,
"__gc"
);
}
}
lua_setmetatable
(
L
,
-
2
);
lua_setmetatable
(
L
,
-
2
);
...
...
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