bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 12/13] userspec: prefer idx_t for indexes


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

* 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 fc3c91d63..e14aeb06a 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 68d54b4a1..a58c4896b 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.30.2




reply via email to

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