diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2021-04-18 16:08:31 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2021-04-18 20:59:51 -0700 |
commit | 9fd0a1ded22094060e351c4df9a1f2448af5eeaf (patch) | |
tree | 33fff26f1babfec4d89c377c6d8370aec02f5440 | |
parent | 650f0a6c66a9debb71e9cdab5ba7494f97206e59 (diff) | |
download | gnulib-9fd0a1ded22094060e351c4df9a1f2448af5eeaf.tar.gz gnulib-9fd0a1ded22094060e351c4df9a1f2448af5eeaf.tar.bz2 |
group-member: simplify via realloc-gnu
* lib/group-member.c, modules/group-member:
Simplify similarly to backupfile.
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | lib/group-member.c | 6 | ||||
-rw-r--r-- | modules/group-member | 2 |
3 files changed, 7 insertions, 5 deletions
@@ -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 17bee831b4..d433f27311 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 aa56ecf7e4..a224d98880 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 |