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.
This commit is contained in:
Lewis Russell
2022-11-14 18:04:36 +00:00
committed by GitHub
parent 3060432007
commit f8c6718277
11 changed files with 186 additions and 98 deletions

View File

@@ -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 {