summaryrefslogtreecommitdiff
path: root/lib/getusershell.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2021-06-11 17:18:57 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2021-06-11 17:20:12 -0700
commit5def80eb1e08706dafee177c87c961c7c3ada396 (patch)
treef891ea1b9c2a8a6e80ea09f827067c1d207b46fd /lib/getusershell.c
parent2322faa02833c144f4a1630dbd4e428a97c8bf13 (diff)
downloadgnulib-5def80eb1e08706dafee177c87c961c7c3ada396.tar.gz
getusershell: prefer idx_t for indexes
* lib/getusershell.c (line_size, readname): Prefer idx_t to size_t for indexes, using idx_t-related allocators.
Diffstat (limited to 'lib/getusershell.c')
-rw-r--r--lib/getusershell.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/getusershell.c b/lib/getusershell.c
index be8a068455..32acd76c06 100644
--- a/lib/getusershell.c
+++ b/lib/getusershell.c
@@ -43,7 +43,7 @@
# include "unlocked-io.h"
#endif
-static size_t readname (char **, size_t *, FILE *);
+static idx_t readname (char **, idx_t *, FILE *);
#if ! defined ADDITIONAL_DEFAULT_SHELLS && defined __MSDOS__
# define ADDITIONAL_DEFAULT_SHELLS \
@@ -70,7 +70,7 @@ static FILE *shellstream = NULL;
static char *line = NULL;
/* Number of bytes allocated for 'line'. */
-static size_t line_size = 0;
+static idx_t line_size = 0;
/* Return an entry from the shells file, ignoring comment lines.
If the file doesn't exist, use the list in DEFAULT_SHELLS (above).
@@ -137,8 +137,8 @@ endusershell (void)
Return the number of bytes placed in *NAME
if some nonempty sequence was found, otherwise 0. */
-static size_t
-readname (char **name, size_t *size, FILE *stream)
+static idx_t
+readname (char **name, idx_t *size, FILE *stream)
{
int c;
size_t name_index = 0;
@@ -150,7 +150,7 @@ readname (char **name, size_t *size, FILE *stream)
for (;;)
{
if (*size <= name_index)
- *name = x2nrealloc (*name, size, sizeof **name);
+ *name = xpalloc (*name, size, 1, -1, sizeof **name);
if (c == EOF || isspace (c))
break;
(*name)[name_index++] = c;