summaryrefslogtreecommitdiff
path: root/core/src/xmake/xmake.c
diff options
context:
space:
mode:
authorruki <[email protected]>2025-11-09 19:11:32 +0800
committerruki <[email protected]>2025-11-09 19:44:18 +0800
commitc89c94bf89e98c8e42e786aacc0b334a57474179 (patch)
tree60b4964d58a5289e1444b2375ec5db1a93eccdd6 /core/src/xmake/xmake.c
parent3f9c6f27ee8f99d5c4393433e8863fec93da43e7 (diff)
format code
Diffstat (limited to 'core/src/xmake/xmake.c')
-rw-r--r--core/src/xmake/xmake.c52
1 files changed, 21 insertions, 31 deletions
diff --git a/core/src/xmake/xmake.c b/core/src/xmake/xmake.c
index 3e7fee7fb..89b288c79 100644
--- a/core/src/xmake/xmake.c
+++ b/core/src/xmake/xmake.c
@@ -27,31 +27,26 @@
/* //////////////////////////////////////////////////////////////////////////////////////
* private implementation
*/
-static __tb_inline__ tb_bool_t xm_check_mode(tb_size_t mode)
-{
+static __tb_inline__ tb_bool_t xm_check_mode(tb_size_t mode) {
#ifdef __xm_debug__
- if (!(mode & TB_MODE_DEBUG))
- {
+ if (!(mode & TB_MODE_DEBUG)) {
tb_trace_e("libxmake.a has __tb_debug__ but xmake/xmake.h not");
return tb_false;
}
#else
- if (mode & TB_MODE_DEBUG)
- {
+ if (mode & TB_MODE_DEBUG) {
tb_trace_e("xmake/xmake.h has __tb_debug__ but libxmake.a not");
return tb_false;
}
#endif
#ifdef __xm_small__
- if (!(mode & TB_MODE_SMALL))
- {
+ if (!(mode & TB_MODE_SMALL)) {
tb_trace_e("libxmake.a has __tb_small__ but xmake/xmake.h not");
return tb_false;
}
#else
- if (mode & TB_MODE_SMALL)
- {
+ if (mode & TB_MODE_SMALL) {
tb_trace_e("xmake/xmake.h has __tb_small__ but libxmake.a not");
return tb_false;
}
@@ -60,19 +55,16 @@ static __tb_inline__ tb_bool_t xm_check_mode(tb_size_t mode)
// ok
return tb_true;
}
-static __tb_inline__ tb_bool_t xm_version_check(tb_hize_t build)
-{
+static __tb_inline__ tb_bool_t xm_version_check(tb_hize_t build) {
// the version oly for link the static vtag string
- tb_version_t const* version = xm_version(); tb_used(version);
+ tb_version_t const *version = xm_version();
+ tb_used(version);
// ok
- if ((build / 100) == (XM_VERSION_BUILD / 100))
- {
+ if ((build / 100) == (XM_VERSION_BUILD / 100)) {
tb_trace_d("version: %s", XM_VERSION_STRING);
return tb_true;
- }
- else
- {
+ } else {
tb_trace_w("version: %s != %llu", XM_VERSION_STRING, build);
}
@@ -83,13 +75,13 @@ static __tb_inline__ tb_bool_t xm_version_check(tb_hize_t build)
/* //////////////////////////////////////////////////////////////////////////////////////
* implementation
*/
-tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build)
-{
+tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build) {
// trace
tb_trace_d("init: ..");
// check mode
- if (!xm_check_mode(mode)) return tb_false;
+ if (!xm_check_mode(mode))
+ return tb_false;
// check version
xm_version_check(build);
@@ -99,7 +91,8 @@ tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build)
if (!tb_init(tb_null, tb_default_allocator(tb_null, 0))) return tb_false;
#else
// init tbox, since small compilation mode is enabled, it still uses the native allocator
- if (!tb_init(tb_null, tb_null)) return tb_false;
+ if (!tb_init(tb_null, tb_null))
+ return tb_false;
#endif
// trace
@@ -108,20 +101,18 @@ tb_bool_t xm_init_(tb_size_t mode, tb_hize_t build)
// ok
return tb_true;
}
-tb_void_t xm_exit()
-{
+tb_void_t xm_exit() {
// exit tbox
tb_exit();
}
-tb_version_t const* xm_version()
-{
+tb_version_t const *xm_version() {
// init version tag for binary search
- static __tb_volatile__ tb_char_t const* s_vtag = "[xmake]: [vtag]: " XM_VERSION_STRING; tb_used(s_vtag);
+ static __tb_volatile__ tb_char_t const *s_vtag = "[xmake]: [vtag]: " XM_VERSION_STRING;
+ tb_used(s_vtag);
// init version
- static tb_version_t s_version = {0};
- if (!s_version.major)
- {
+ static tb_version_t s_version = { 0 };
+ if (!s_version.major) {
s_version.major = XM_VERSION_MAJOR;
s_version.minor = XM_VERSION_MINOR;
s_version.alter = XM_VERSION_ALTER;
@@ -130,4 +121,3 @@ tb_version_t const* xm_version()
return &s_version;
}
-