From f3464103fbe0589b32e12d6c18dcf9dbfaa421e8 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 4 Nov 2024 17:48:39 +0100 Subject: [PATCH] lib/gshadow.c: build_list(): Improve variable and parameter names It was hard to understand what each variable is. Use a consistent scheme, where a 'p' means a pointer, 'l' means list, and 'n' means number of elements. Those should be obvious from the name of the function and the context, and will make it easier to read the code. Also, the shorter names will allow focusing on the rest of the code. Signed-off-by: Alejandro Colomar --- lib/gshadow.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/gshadow.c b/lib/gshadow.c index 4f2d5925..7375049d 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -37,24 +37,24 @@ static struct sgrp sgroup; static /*@null@*/char ** -build_list(char *s, char ***list, size_t *nlist) +build_list(char *s, char ***lp, size_t *np) { - char **ptr = *list; - size_t nelem = *nlist; + char **l = *lp; + size_t n = *np; while (s != NULL && *s != '\0') { - ptr = XREALLOC(*list, nelem + 1, char *); - ptr[nelem] = strsep(&s, ","); - nelem++; - *list = ptr; - *nlist = nelem; + l = XREALLOC(*lp, n + 1, char *); + l[n] = strsep(&s, ","); + n++; + *lp = l; + *np = n; } - ptr = XREALLOC(*list, nelem + 1, char *); - ptr[nelem] = NULL; - *list = ptr; + l = XREALLOC(*lp, n + 1, char *); + l[n] = NULL; + *lp = l; - return ptr; + return l; } void setsgent (void)