diff options
author | Lewis Russell <lewis6991@gmail.com> | 2022-11-14 18:04:36 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-14 18:04:36 +0000 |
commit | f8c671827710c6e9cca3bfd60c32098b2be8239a (patch) | |
tree | a5d949663a1b061ca82ecd89bb90f083f9a2bbb8 /src/nvim/option.c | |
parent | 30604320072335122aea0f37890f136b2ba0e445 (diff) | |
download | rneovim-f8c671827710c6e9cca3bfd60c32098b2be8239a.tar.gz rneovim-f8c671827710c6e9cca3bfd60c32098b2be8239a.tar.bz2 rneovim-f8c671827710c6e9cca3bfd60c32098b2be8239a.zip |
feat(lua-api): avoid unnecessary allocations (#19877)
Lua makes (or reuses) an internal copy of strings, so we can safely push
buf pointers onto the stack.
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r-- | src/nvim/option.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c index 23c4a1ccf3..330900a9d6 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -3012,7 +3012,7 @@ int get_option_value_strict(char *name, int64_t *numval, char **stringval, int o if (varp != NULL) { if (p->flags & P_STRING) { - *stringval = xstrdup(*(char **)(varp)); + *stringval = *(char **)(varp); } else if (p->flags & P_NUM) { *numval = *(long *)varp; } else { |