refactor: change some xstrndup() and xstrnsave() to xmemdupz() (#25959)

When the given length is exactly the number of bytes to copy, xmemdupz()
makes the intention clearer.
This commit is contained in:
zeertzjq
2023-11-10 08:39:21 +08:00
committed by GitHub
parent ae8ca79920
commit cd63a9addd
32 changed files with 64 additions and 67 deletions

View File

@@ -1654,7 +1654,7 @@ char *eval_map_expr(mapblock_T *mp, int c)
Array args = ARRAY_DICT_INIT;
Object ret = nlua_call_ref(mp->m_luaref, NULL, args, true, &err);
if (ret.type == kObjectTypeString) {
p = xstrndup(ret.data.string.data, ret.data.string.size);
p = string_to_cstr(ret.data.string);
}
api_free_object(ret);
if (err.type != kErrorTypeNone) {