From: Paul Eggert Date: Sat, 12 Jun 2021 00:18:58 +0000 (-0700) Subject: xgethostname: prefer idx_t for indexes X-Git-Tag: v1.0~2817 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=00a11ae0d681fb7b33bd877ab9d904c389f66c3d;p=gnulib.git xgethostname: prefer idx_t for indexes * lib/xgethostname.c (XGETANAME): Prefer idx_t to size_t for indexes, using idx_t-related allocators. --- diff --git a/ChangeLog b/ChangeLog index e14aeb06a7..c9fd316ab4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,7 @@ * lib/savedir.c (streamsavedir): * lib/stack.h (_GL_STACK_TYPE, _GL_STACK_PREFIX): * lib/userspec.c (parse_with_separator): + * lib/xgethostname.c (XGETANAME): 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/xgethostname.c b/lib/xgethostname.c index 87ae6dce87..84c2f279bb 100644 --- a/lib/xgethostname.c +++ b/lib/xgethostname.c @@ -59,7 +59,7 @@ XGETANAME (void) specify whether a truncated name is null-terminated. */ idx_t actual_size = strlen (name) + 1; if (actual_size < size_1) - return alloc ? alloc : xmemdup (name, actual_size); + return alloc ? alloc : ximemdup (name, actual_size); errno = 0; } free (alloc);