Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
e43d4290
Commit
e43d4290
authored
2 years ago
by
Jan-Niklas Burfeind
Browse files
Options
Downloads
Patches
Plain Diff
gluon-core: fix c indentation
parent
6ff32179
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
package/gluon-core/src/site.c
+62
-62
62 additions, 62 deletions
package/gluon-core/src/site.c
with
62 additions
and
62 deletions
package/gluon-core/src/site.c
+
62
−
62
View file @
e43d4290
...
@@ -10,104 +10,104 @@
...
@@ -10,104 +10,104 @@
static
struct
json_object
*
gluon_site_udata
(
lua_State
*
L
,
int
narg
)
{
static
struct
json_object
*
gluon_site_udata
(
lua_State
*
L
,
int
narg
)
{
return
*
(
struct
json_object
**
)
luaL_checkudata
(
L
,
narg
,
UDATA
);
return
*
(
struct
json_object
**
)
luaL_checkudata
(
L
,
narg
,
UDATA
);
}
}
static
void
gluon_site_push_none
(
lua_State
*
L
)
{
static
void
gluon_site_push_none
(
lua_State
*
L
)
{
lua_pushlightuserdata
(
L
,
gluon_site_push_none
);
lua_pushlightuserdata
(
L
,
gluon_site_push_none
);
lua_rawget
(
L
,
LUA_REGISTRYINDEX
);
lua_rawget
(
L
,
LUA_REGISTRYINDEX
);
}
}
static
void
gluon_site_do_wrap
(
lua_State
*
L
,
struct
json_object
*
obj
)
{
static
void
gluon_site_do_wrap
(
lua_State
*
L
,
struct
json_object
*
obj
)
{
struct
json_object
**
objp
=
lua_newuserdata
(
L
,
sizeof
(
struct
json_object
*
));
struct
json_object
**
objp
=
lua_newuserdata
(
L
,
sizeof
(
struct
json_object
*
));
*
objp
=
json_object_get
(
obj
);
*
objp
=
json_object_get
(
obj
);
luaL_getmetatable
(
L
,
UDATA
);
luaL_getmetatable
(
L
,
UDATA
);
lua_setmetatable
(
L
,
-
2
);
lua_setmetatable
(
L
,
-
2
);
}
}
static
void
gluon_site_wrap
(
lua_State
*
L
,
struct
json_object
*
obj
)
{
static
void
gluon_site_wrap
(
lua_State
*
L
,
struct
json_object
*
obj
)
{
if
(
obj
)
if
(
obj
)
gluon_site_do_wrap
(
L
,
obj
);
gluon_site_do_wrap
(
L
,
obj
);
else
else
gluon_site_push_none
(
L
);
gluon_site_push_none
(
L
);
}
}
static
int
gluon_site_index
(
lua_State
*
L
)
{
static
int
gluon_site_index
(
lua_State
*
L
)
{
struct
json_object
*
obj
=
gluon_site_udata
(
L
,
1
);
struct
json_object
*
obj
=
gluon_site_udata
(
L
,
1
);
const
char
*
key
;
const
char
*
key
;
lua_Number
lua_index
;
lua_Number
lua_index
;
size_t
index
;
size_t
index
;
struct
json_object
*
v
=
NULL
;
struct
json_object
*
v
=
NULL
;
switch
(
json_object_get_type
(
obj
))
{
switch
(
json_object_get_type
(
obj
))
{
case
json_type_object
:
case
json_type_object
:
key
=
lua_tostring
(
L
,
2
);
key
=
lua_tostring
(
L
,
2
);
if
(
key
)
if
(
key
)
json_object_object_get_ex
(
obj
,
key
,
&
v
);
json_object_object_get_ex
(
obj
,
key
,
&
v
);
break
;
break
;
case
json_type_array
:
case
json_type_array
:
index
=
lua_index
=
lua_tonumber
(
L
,
2
);
index
=
lua_index
=
lua_tonumber
(
L
,
2
);
if
(
lua_index
==
(
lua_Number
)
index
&&
index
>=
1
)
if
(
lua_index
==
(
lua_Number
)
index
&&
index
>=
1
)
v
=
json_object_array_get_idx
(
obj
,
index
-
1
);
v
=
json_object_array_get_idx
(
obj
,
index
-
1
);
break
;
break
;
case
json_type_string
:
case
json_type_string
:
case
json_type_null
:
case
json_type_null
:
break
;
break
;
case
json_type_boolean
:
case
json_type_boolean
:
case
json_type_int
:
case
json_type_int
:
case
json_type_double
:
case
json_type_double
:
luaL_error
(
L
,
"attempt to index a number or boolean value"
);
luaL_error
(
L
,
"attempt to index a number or boolean value"
);
__builtin_unreachable
();
__builtin_unreachable
();
}
}
gluon_site_wrap
(
L
,
v
);
gluon_site_wrap
(
L
,
v
);
return
1
;
return
1
;
}
}
static
int
gluon_site_call
(
lua_State
*
L
)
{
static
int
gluon_site_call
(
lua_State
*
L
)
{
struct
json_object
*
obj
=
gluon_site_udata
(
L
,
1
);
struct
json_object
*
obj
=
gluon_site_udata
(
L
,
1
);
if
(
obj
)
{
if
(
obj
)
{
lua_jsonc_push_json
(
L
,
obj
);
lua_jsonc_push_json
(
L
,
obj
);
}
else
{
}
else
{
if
(
lua_isnone
(
L
,
2
))
if
(
lua_isnone
(
L
,
2
))
lua_pushnil
(
L
);
lua_pushnil
(
L
);
else
else
lua_pushvalue
(
L
,
2
);
lua_pushvalue
(
L
,
2
);
}
}
return
1
;
return
1
;
}
}
static
int
gluon_site_gc
(
lua_State
*
L
)
{
static
int
gluon_site_gc
(
lua_State
*
L
)
{
json_object_put
(
gluon_site_udata
(
L
,
1
));
json_object_put
(
gluon_site_udata
(
L
,
1
));
return
0
;
return
0
;
}
}
static
const
luaL_reg
R
[]
=
{
static
const
luaL_reg
R
[]
=
{
{
"__index"
,
gluon_site_index
},
{
"__index"
,
gluon_site_index
},
{
"__call"
,
gluon_site_call
},
{
"__call"
,
gluon_site_call
},
{
"__gc"
,
gluon_site_gc
},
{
"__gc"
,
gluon_site_gc
},
{}
{}
};
};
int
luaopen_gluon_site
(
lua_State
*
L
)
{
int
luaopen_gluon_site
(
lua_State
*
L
)
{
luaL_newmetatable
(
L
,
UDATA
);
luaL_newmetatable
(
L
,
UDATA
);
luaL_register
(
L
,
NULL
,
R
);
luaL_register
(
L
,
NULL
,
R
);
lua_pop
(
L
,
1
);
lua_pop
(
L
,
1
);
/* Create "none" object */
/* Create "none" object */
lua_pushlightuserdata
(
L
,
gluon_site_push_none
);
lua_pushlightuserdata
(
L
,
gluon_site_push_none
);
gluon_site_do_wrap
(
L
,
NULL
);
gluon_site_do_wrap
(
L
,
NULL
);
lua_rawset
(
L
,
LUA_REGISTRYINDEX
);
lua_rawset
(
L
,
LUA_REGISTRYINDEX
);
struct
json_object
*
site
=
gluonutil_load_site_config
();
struct
json_object
*
site
=
gluonutil_load_site_config
();
gluon_site_wrap
(
L
,
site
);
gluon_site_wrap
(
L
,
site
);
json_object_put
(
site
);
json_object_put
(
site
);
return
1
;
return
1
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment