From 3672ae90461db1dc3381ab780ab37bd094871be8 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 11 Jun 2021 17:18:58 -0700 Subject: [PATCH] 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. --- ChangeLog | 1 + lib/userspec.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index fc3c91d63c..e14aeb06a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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'; } } -- 2.39.5