From 59905416083c60a3453695fa3f4483d855631de5 Mon Sep 17 00:00:00 2001 From: Konstantin Osipov <kostja@tarantool.org> Date: Sat, 10 Oct 2015 12:30:12 +0300 Subject: [PATCH] arm: cfg.cc -> cfg.c --- src/CMakeLists.txt | 2 +- src/{cfg.cc => cfg.c} | 6 +++--- src/cfg.h | 8 ++++++++ src/lua/utils.h | 15 ++++++++------- 4 files changed, 20 insertions(+), 11 deletions(-) rename src/{cfg.cc => cfg.c} (96%) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62c6081f1a..31cfdf7fea 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -93,7 +93,7 @@ set (server_sources random.c scramble.c opts.c - cfg.cc + cfg.c cpu_feature.c fiob.c tt_uuid.c diff --git a/src/cfg.cc b/src/cfg.c similarity index 96% rename from src/cfg.cc rename to src/cfg.c index 0e7f5b22e4..67c7c4a9e5 100644 --- a/src/cfg.cc +++ b/src/cfg.c @@ -38,7 +38,7 @@ cfg_get(const char *param) { char buf[MAX_OPT_NAME_LEN]; snprintf(buf, sizeof(buf), "return box.cfg.%s", param); - luaL_dostring(tarantool_L, buf); + (void) luaL_dostring(tarantool_L, buf); } int @@ -58,8 +58,8 @@ cfg_geti(const char *param) static const char * cfg_tostring(struct lua_State *L) { - static char __thread values[MAX_STR_OPTS][MAX_OPT_VAL_LEN]; - static int __thread i = 0; + static __thread char values[MAX_STR_OPTS][MAX_OPT_VAL_LEN]; + static __thread int i = 0; if (lua_isnil(L, -1)) return NULL; else { diff --git a/src/cfg.h b/src/cfg.h index ed279c1961..e7e701b1a5 100644 --- a/src/cfg.h +++ b/src/cfg.h @@ -30,6 +30,10 @@ * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ +#if defined(__cplusplus) +extern "C" { +#endif /* defined(__cplusplus) */ + int cfg_geti(const char *param); @@ -45,4 +49,8 @@ cfg_getarr_size(const char *name); const char * cfg_getarr_elem(const char *name, int i); +#if defined(__cplusplus) +} /* extern "C" */ +#endif /* defined(__cplusplus) */ + #endif /* INCLUDES_TARANTOOL_CFG_H */ diff --git a/src/lua/utils.h b/src/lua/utils.h index 0d8af06dec..3dd5967a7c 100644 --- a/src/lua/utils.h +++ b/src/lua/utils.h @@ -54,6 +54,14 @@ extern "C" { struct lua_State; +/** + * Single global lua_State shared by core and modules. + * Created with tarantool_lua_init(). + * const char *msg = lua_tostring(L, -1); + * snprintf(m_errmsg, sizeof(m_errmsg), "%s", msg ? msg : ""); + */ +extern struct lua_State *tarantool_L; + /** \cond public */ /** @@ -526,13 +534,6 @@ lbox_call(struct lua_State *L, int nargs, int nreturns) } } -/** - * Single global lua_State shared by core and modules. - * Created with tarantool_lua_init(). - * const char *msg = lua_tostring(L, -1); - * snprintf(m_errmsg, sizeof(m_errmsg), "%s", msg ? msg : ""); - */ -extern struct lua_State *tarantool_L; /** * Make a reference to an object on top of the Lua stack and -- GitLab