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

@@ -1993,7 +1993,7 @@ static char *next_fenc(char **pp, bool *alloced)
r = enc_canonize(*pp);
*pp += strlen(*pp);
} else {
r = xstrnsave(*pp, (size_t)(p - *pp));
r = xmemdupz(*pp, (size_t)(p - *pp));
*pp = p + 1;
p = enc_canonize(r);
xfree(r);