diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-06-11 17:18:58 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-06-11 17:20:13 -0700 |
commit | 3672ae90461db1dc3381ab780ab37bd094871be8 (patch) | |
tree | e41c6fd11a4a64bfaac9f338c60aed521de1e232 | |
parent | 3dc36216f168f4e752b648b19d85eab32a037827 (diff) | |
download | gnulib-3672ae90461db1dc3381ab780ab37bd094871be8.tar.gz |
userspec: prefer idx_t for indexes
* lib/userspec.c (parse_with_separator):
Prefer idx_t to size_t for indexes, using idx_t-related allocators.
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/userspec.c | 4 |
2 files changed, 3 insertions, 2 deletions
@@ -14,6 +14,7 @@ * lib/readutmp.c (read_utmp): * lib/savedir.c (streamsavedir): * lib/stack.h (_GL_STACK_TYPE, _GL_STACK_PREFIX): + * lib/userspec.c (parse_with_separator): Prefer idx_t to size_t for indexes, and use idx_t-related allocators. * lib/basename.c: Do not include xstrndup.h. (basename): Simplify by always using memcpy. diff --git a/lib/userspec.c b/lib/userspec.c index 68d54b4a10..a58c4896bb 100644 --- a/lib/userspec.c +++ b/lib/userspec.c @@ -134,10 +134,10 @@ parse_with_separator (char const *spec, char const *separator, } else { - size_t ulen = separator - spec; + idx_t ulen = separator - spec; if (ulen != 0) { - u = xmemdup (spec, ulen + 1); + u = ximemdup (spec, ulen + 1); u[ulen] = '\0'; } } |