[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
- [PATCH 1/8] safe-alloc: improve doc, Paul Eggert, 2021/04/19
- [PATCH 2/8] backupfile: simplify via realloc-gnu, Paul Eggert, 2021/04/19
- [PATCH 3/8] group-member: simplify via realloc-gnu,
Paul Eggert <=
- [PATCH 4/8] xalloc: new function xreallocarray, Paul Eggert, 2021/04/19
- [PATCH 6/8] safe-alloc: simplify via reallocarray, Paul Eggert, 2021/04/19
- [PATCH 7/8] calloc-gnu: now LGPLv2+, Paul Eggert, 2021/04/19
- [PATCH 8/8] safe-alloc: fix pointer implementation, Paul Eggert, 2021/04/19
- [PATCH 5/8] xalloc-oversized: fix SIZE_MAX optimization bug, Paul Eggert, 2021/04/19
- Re: [PATCH 1/8] safe-alloc: improve doc, Eric Blake, 2021/04/22