From: Alejandro Colomar Date: Mon, 4 Nov 2024 16:48:39 +0000 (+0100) Subject: lib/gshadow.c: build_list(): Improve variable and parameter names X-Git-Tag: 4.17.0-rc1~12 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f3464103fbe0589b32e12d6c18dcf9dbfaa421e8;p=thirdparty%2Fshadow.git 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 --- diff --git a/lib/gshadow.c b/lib/gshadow.c index 4f2d5925f..7375049dd 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)