diff options
Diffstat (limited to 'src/nvim/context.c')
-rw-r--r-- | src/nvim/context.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/src/nvim/context.c b/src/nvim/context.c index 34692cdf64..b064a92b74 100644 --- a/src/nvim/context.c +++ b/src/nvim/context.c @@ -3,16 +3,28 @@ // Context: snapshot of the entire editor state as one big object/map +#include <assert.h> +#include <stdbool.h> +#include <stdio.h> + #include "nvim/api/private/converter.h" #include "nvim/api/private/helpers.h" -#include "nvim/api/vim.h" #include "nvim/api/vimscript.h" #include "nvim/context.h" #include "nvim/eval/encode.h" +#include "nvim/eval/typval.h" +#include "nvim/eval/typval_defs.h" #include "nvim/eval/userfunc.h" #include "nvim/ex_docmd.h" +#include "nvim/gettext.h" +#include "nvim/hashtab.h" +#include "nvim/keycodes.h" +#include "nvim/memory.h" +#include "nvim/message.h" #include "nvim/option.h" #include "nvim/shada.h" +#include "nvim/types.h" +#include "nvim/vim.h" #ifdef INCLUDE_GENERATED_DECLARATIONS # include "context.c.generated.h" @@ -131,7 +143,7 @@ bool ctx_restore(Context *ctx, const int flags) } char *op_shada; - get_option_value("shada", NULL, &op_shada, OPT_GLOBAL); + get_option_value("shada", NULL, &op_shada, NULL, OPT_GLOBAL); set_option_value("shada", 0L, "!,'100,%", OPT_GLOBAL); if (flags & kCtxRegs) { @@ -251,12 +263,12 @@ static inline void ctx_save_funcs(Context *ctx, bool scriptonly) Error err = ERROR_INIT; HASHTAB_ITER(func_tbl_get(), hi, { - const char_u *const name = hi->hi_key; - bool islambda = (STRNCMP(name, "<lambda>", 8) == 0); - bool isscript = (name[0] == K_SPECIAL); + const char *const name = hi->hi_key; + bool islambda = (strncmp(name, "<lambda>", 8) == 0); + bool isscript = ((uint8_t)name[0] == K_SPECIAL); if (!islambda && (!scriptonly || isscript)) { - size_t cmd_len = sizeof("func! ") + STRLEN(name); + size_t cmd_len = sizeof("func! ") + strlen(name); char *cmd = xmalloc(cmd_len); snprintf(cmd, cmd_len, "func! %s", name); String func_body = nvim_exec(VIML_INTERNAL_CALL, cstr_as_string(cmd), |