bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH 3/8] group-member: simplify via realloc-gnu


From: Paul Eggert
Subject: [PATCH 3/8] group-member: simplify via realloc-gnu
Date: Sun, 18 Apr 2021 21:01:54 -0700

* lib/group-member.c, modules/group-member:
Simplify similarly to backupfile.
---
 ChangeLog            | 4 ++++
 lib/group-member.c   | 6 ++----
 modules/group-member | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e00a5b7c8..aff0e87fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2021-04-18  Paul Eggert  <eggert@cs.ucla.edu>
 
+       group-member: simplify via realloc-gnu
+       * lib/group-member.c, modules/group-member:
+       Simplify similarly to backupfile.
+
        backupfile: simplify via realloc-gnu
        * lib/backupfile.c: Do not include xalloc-oversized.h.
        (numbered_backup): Simplify now that realloc will do the right
diff --git a/lib/group-member.c b/lib/group-member.c
index 17bee831b..d433f2731 100644
--- a/lib/group-member.c
+++ b/lib/group-member.c
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 
 #include "intprops.h"
-#include "xalloc-oversized.h"
 
 /* Most processes have no more than this many groups, and for these
    processes we can avoid using malloc.  */
@@ -54,9 +53,8 @@ get_group_info (struct group_info *gi)
   if (n_groups < 0)
     {
       int n_group_slots = getgroups (0, NULL);
-      xalloc_count_t nbytes;
-      if (0 <= n_group_slots
-          && ! INT_MULTIPLY_WRAPV (n_group_slots, sizeof *gi->group, &nbytes))
+      size_t nbytes;
+      if (! INT_MULTIPLY_WRAPV (n_group_slots, sizeof *gi->group, &nbytes))
         {
           gi->group = malloc (nbytes);
           if (gi->group)
diff --git a/modules/group-member b/modules/group-member
index aa56ecf7e..a224d9888 100644
--- a/modules/group-member
+++ b/modules/group-member
@@ -10,7 +10,7 @@ unistd
 extensions
 getgroups        [test $HAVE_GROUP_MEMBER = 0]
 intprops         [test $HAVE_GROUP_MEMBER = 0]
-xalloc-oversized [test $HAVE_GROUP_MEMBER = 0]
+realloc-gnu      [test $HAVE_GROUP_MEMBER = 0]
 
 configure.ac:
 gl_FUNC_GROUP_MEMBER
-- 
2.27.0




reply via email to

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