bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 13/13] xgethostname: prefer idx_t for indexes


From: Paul Eggert
Subject: [PATCH 13/13] xgethostname: prefer idx_t for indexes
Date: Fri, 11 Jun 2021 17:25:53 -0700

* lib/xgethostname.c (XGETANAME):
Prefer idx_t to size_t for indexes, using idx_t-related allocators.
---
 ChangeLog          | 1 +
 lib/xgethostname.c | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index e14aeb06a..c9fd316ab 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 87ae6dce8..84c2f279b 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);
-- 
2.30.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]