diff options
author | ZyX <kp-pav@yandex.ru> | 2017-01-29 03:08:56 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-03-27 00:12:23 +0300 |
commit | 3531d8c8eaa6783637f510dbc5dbd58c9d435b61 (patch) | |
tree | ebf01bfab5247b59586d218a3a3ebf75b466f6ae | |
parent | 872a909150506828f72a63636e1cfd6b72f1b306 (diff) | |
download | rneovim-3531d8c8eaa6783637f510dbc5dbd58c9d435b61.tar.gz rneovim-3531d8c8eaa6783637f510dbc5dbd58c9d435b61.tar.bz2 rneovim-3531d8c8eaa6783637f510dbc5dbd58c9d435b61.zip |
executor: Add some const qualifiers
-rw-r--r-- | src/nvim/viml/executor/executor.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/nvim/viml/executor/executor.c b/src/nvim/viml/executor/executor.c index 8da218270a..38e3cf1c6d 100644 --- a/src/nvim/viml/executor/executor.c +++ b/src/nvim/viml/executor/executor.c @@ -100,7 +100,7 @@ static void nlua_error(lua_State *const lstate, const char *const msg) /// /// Does no error handling: never call it with non-string or with some arguments /// omitted. -static int nlua_stricmp(lua_State *lstate) FUNC_ATTR_NONNULL_ALL +static int nlua_stricmp(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { const char *s1 = luaL_checklstring(lstate, 1, NULL); const char *s2 = luaL_checklstring(lstate, 2, NULL); @@ -115,10 +115,10 @@ static int nlua_stricmp(lua_State *lstate) FUNC_ATTR_NONNULL_ALL /// Expects two values on the stack: string to evaluate, pointer to the /// location where result is saved. Always returns nothing (from the lua point /// of view). -static int nlua_exec_lua_string(lua_State *lstate) FUNC_ATTR_NONNULL_ALL +static int nlua_exec_lua_string(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { - String *str = (String *)lua_touserdata(lstate, 1); - typval_T *ret_tv = (typval_T *)lua_touserdata(lstate, 2); + const String *const str = (String *)lua_touserdata(lstate, 1); + typval_T *const ret_tv = (typval_T *)lua_touserdata(lstate, 2); lua_pop(lstate, 2); if (luaL_loadbuffer(lstate, str->data, str->size, NLUA_EVAL_NAME)) { @@ -138,7 +138,7 @@ static int nlua_exec_lua_string(lua_State *lstate) FUNC_ATTR_NONNULL_ALL /// Initialize lua interpreter state /// /// Called by lua interpreter itself to initialize state. -static int nlua_state_init(lua_State *lstate) FUNC_ATTR_NONNULL_ALL +static int nlua_state_init(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { lua_pushcfunction(lstate, &nlua_stricmp); lua_setglobal(lstate, "stricmp"); @@ -177,14 +177,15 @@ static lua_State *global_lstate = NULL; /// @param[out] ret_tv Location where result will be saved. /// /// @return Result of the execution. -void executor_exec_lua(String str, typval_T *ret_tv) +void executor_exec_lua(const String str, typval_T *const ret_tv) FUNC_ATTR_NONNULL_ALL { if (global_lstate == NULL) { global_lstate = init_lua(); } - NLUA_CALL_C_FUNCTION_2(global_lstate, nlua_exec_lua_string, 0, &str, ret_tv); + NLUA_CALL_C_FUNCTION_2(global_lstate, nlua_exec_lua_string, 0, + (void *)&str, ret_tv); } /// Evaluate lua string @@ -196,12 +197,12 @@ void executor_exec_lua(String str, typval_T *ret_tv) /// 3. Pointer to location where result is saved. /// /// @param[in,out] lstate Lua interpreter state. -static int nlua_eval_lua_string(lua_State *lstate) +static int nlua_eval_lua_string(lua_State *const lstate) FUNC_ATTR_NONNULL_ALL { - String *str = (String *)lua_touserdata(lstate, 1); - typval_T *arg = (typval_T *)lua_touserdata(lstate, 2); - typval_T *ret_tv = (typval_T *)lua_touserdata(lstate, 3); + const String *const str = (String *)lua_touserdata(lstate, 1); + typval_T *const arg = (typval_T *)lua_touserdata(lstate, 2); + typval_T *const ret_tv = (typval_T *)lua_touserdata(lstate, 3); lua_pop(lstate, 3); garray_T str_ga; |