diff options
| author | ruki <[email protected]> | 2017-05-08 16:41:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-05-08 16:41:02 +0800 |
| commit | cd28c287fbbcc4901a864623d6c1ef92f1487234 (patch) | |
| tree | 30bf6b8ea740ab517ba761a847f1a6b059dc52ab /core | |
| parent | 5da5e37eed97e96247ff198c411793f32e5c9916 (diff) | |
format versioninfo code style
Diffstat (limited to 'core')
| -rw-r--r-- | core/detect/readline.c | 11 | ||||
| -rw-r--r-- | core/src/xmake/machine.c | 2 | ||||
| -rw-r--r-- | core/src/xmake/os/versioninfo.c | 59 |
3 files changed, 42 insertions, 30 deletions
diff --git a/core/detect/readline.c b/core/detect/readline.c index 13452bd84..346a07e09 100644 --- a/core/detect/readline.c +++ b/core/detect/readline.c @@ -1,3 +1,8 @@ -#include<stdio.h> -#include<readline/readline.h> -int main(){readline(0);return 0;} +#include <stdio.h> +#include <readline/readline.h> + +int main() +{ + readline(0); + return 0; +} diff --git a/core/src/xmake/machine.c b/core/src/xmake/machine.c index b0e86fd00..b9977d92a 100644 --- a/core/src/xmake/machine.c +++ b/core/src/xmake/machine.c @@ -132,7 +132,7 @@ static luaL_Reg const g_os_functions[] = , { "emptydir", xm_os_emptydir } , { "strerror", xm_os_strerror } , { "getwinsize", xm_os_getwinsize} -, { "versioninfo", xm_os_versioninfo} +, { "versioninfo", xm_os_versioninfo} , { tb_null, tb_null } }; diff --git a/core/src/xmake/os/versioninfo.c b/core/src/xmake/os/versioninfo.c index f9e3fe890..ea75049c3 100644 --- a/core/src/xmake/os/versioninfo.c +++ b/core/src/xmake/os/versioninfo.c @@ -35,10 +35,10 @@ #include "prefix.h" /* ////////////////////////////////////////////////////////////////////////////////////// - * implementation + * private implementation */ -static void xm_os_insert_set(lua_State* lua, const char** p) +static tb_void_t xm_os_insert_set(lua_State* lua, tb_char_t const** p) { for (; *p; ++p) { @@ -48,15 +48,20 @@ static void xm_os_insert_set(lua_State* lua, const char** p) } } +/* ////////////////////////////////////////////////////////////////////////////////////// + * implementation + */ + // get versioninfo tb_int_t xm_os_versioninfo(lua_State* lua) { // features - const char* features_table[] = { -# ifdef XM_CONFIG_API_HAVE_READLINE - "readline", -# endif - tb_null + static tb_char_t const* features_table[] = + { +#ifdef XM_CONFIG_API_HAVE_READLINE + "readline", +#endif + tb_null }; // configuration table @@ -177,14 +182,15 @@ tb_int_t xm_os_versioninfo(lua_State* lua) lua_settable(lua, -3); // mode table - const char* mode_table[] = { -# ifdef __xm_small__ - "small", -# endif -# ifdef __xm_debug__ - "debug", -# endif - tb_null + static tb_char_t const* mode_table[] = + { +#ifdef __xm_small__ + "small", +#endif +#ifdef __xm_debug__ + "debug", +#endif + tb_null }; // table for mode @@ -198,17 +204,18 @@ tb_int_t xm_os_versioninfo(lua_State* lua) lua_settable(lua, -3); // packages table - const char* packages_table[] = { -# ifdef XM_CONFIG_PACKAGE_HAVE_TBOX - "tbox", -# endif -# ifdef XM_CONFIG_PACKAGE_HAVE_LUAJIT - "luajit", -# endif -# ifdef XM_CONFIG_PACKAGE_HAVE_BASE - "base", -# endif - tb_null + tb_char_t const* packages_table[] = + { +#ifdef XM_CONFIG_PACKAGE_HAVE_TBOX + "tbox", +#endif +#ifdef XM_CONFIG_PACKAGE_HAVE_LUAJIT + "luajit", +#endif +#ifdef XM_CONFIG_PACKAGE_HAVE_BASE + "base", +#endif + tb_null }; // table for packages |
