summaryrefslogtreecommitdiff
path: root/xmake/templates/c/module.shared/project
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-09 19:51:04 +0800
committerruki <[email protected]>2025-11-09 19:51:04 +0800
commit91f6ed08fe32e36d555129efa4afdd82113f0eb4 (patch)
tree2bfee23488c8479c83833677262ee83b9e362cbb /xmake/templates/c/module.shared/project
parentc89c94bf89e98c8e42e786aacc0b334a57474179 (diff)
format tests and templates
Diffstat (limited to 'xmake/templates/c/module.shared/project')
-rw-r--r--xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c13
-rw-r--r--xmake/templates/c/module.shared/project/src/main.c2
2 files changed, 5 insertions, 10 deletions
diff --git a/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c b/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c
index a98baca02..adde214ca 100644
--- a/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c
+++ b/xmake/templates/c/module.shared/project/modules/shared/foo/src/foo.c
@@ -1,27 +1,22 @@
#include <xmi.h>
-static int add(lua_State* lua) {
+static int add(lua_State *lua) {
int a = lua_tointeger(lua, 1);
int b = lua_tointeger(lua, 2);
lua_pushinteger(lua, a + b);
return 1;
}
-static int sub(lua_State* lua) {
+static int sub(lua_State *lua) {
int a = lua_tointeger(lua, 1);
int b = lua_tointeger(lua, 2);
lua_pushinteger(lua, a - b);
return 1;
}
-int luaopen(foo, lua_State* lua) {
- static const luaL_Reg funcs[] = {
- {"add", add},
- {"sub", sub},
- {NULL, NULL}
- };
+int luaopen(foo, lua_State *lua) {
+ static const luaL_Reg funcs[] = { { "add", add }, { "sub", sub }, { NULL, NULL } };
lua_newtable(lua);
luaL_setfuncs(lua, funcs, 0);
return 1;
}
-
diff --git a/xmake/templates/c/module.shared/project/src/main.c b/xmake/templates/c/module.shared/project/src/main.c
index 113930e1a..ccf4b2a77 100644
--- a/xmake/templates/c/module.shared/project/src/main.c
+++ b/xmake/templates/c/module.shared/project/src/main.c
@@ -1,6 +1,6 @@
#include <stdio.h>
-int main(int argc, char** argv) {
+int main(int argc, char **argv) {
printf("hello world!\n");
return 0;
}