diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62c6081f1a3d333ad3aaa4fa1e3419c860e52556..31cfdf7fea9156f974d9da37aadf1bbfe661e428 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 0e7f5b22e4c997fbf7a0bd1dae01abfa6a52784e..67c7c4a9e533e46ee7fc7e785f0fc4add1e4c9d7 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 ed279c196152e3fc9371c864776606717e4b9800..e7e701b1a565dacffb8da2aed6096745bc0a4342 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 0d8af06dec2371193d759c9c3eced8291ca45e2d..3dd5967a7ca446b8e29c3d9355ec2cf1e00bea3d 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