]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
env: prefer xpalloc to x2nrealloc
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 7 Nov 2024 00:21:15 +0000 (16:21 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 9 Nov 2024 07:41:18 +0000 (23:41 -0800)
* src/env.c (usvars_alloc): Use idx_t for size.
(append_unset_var): Use xpalloc instead of x2nrealloc.

src/env.c

index af876fa08b4ba01de30919b3115d9f3d222201ef..45c94ed092afaf9a8272e1136b695e56c745da95 100644 (file)
--- a/src/env.c
+++ b/src/env.c
@@ -38,7 +38,7 @@
 
 /* Array of envvars to unset.  */
 static char const **usvars;
-static size_t usvars_alloc;
+static idx_t usvars_alloc;
 static idx_t usvars_used;
 
 /* Annotate the output with extra info to aid the user.  */
@@ -171,7 +171,7 @@ static void
 append_unset_var (char const *var)
 {
   if (usvars_used == usvars_alloc)
-    usvars = x2nrealloc (usvars, &usvars_alloc, sizeof *usvars);
+    usvars = xpalloc (usvars, &usvars_alloc, 1, -1, sizeof *usvars);
   usvars[usvars_used++] = var;
 }