From 3feff7ae5b740999f0994027b3fb12b9c1ae1107 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 4 Nov 2024 21:57:06 +0100 Subject: [PATCH] lib/gshadow.c: build_list(): Minimize use of pointer parameters Use instead automatic variables as much as possible. This reduces the number of dereferences, enhancing readability. Signed-off-by: Alejandro Colomar --- lib/gshadow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gshadow.c b/lib/gshadow.c index 87546621..af027226 100644 --- a/lib/gshadow.c +++ b/lib/gshadow.c @@ -40,18 +40,18 @@ build_list(char *s, char ***lp) char **l; size_t n; - *lp = NULL; + l = NULL; n = 0; while (s != NULL && *s != '\0') { - l = XREALLOC(*lp, n + 1, char *); + l = XREALLOC(l, n + 1, char *); l[n] = strsep(&s, ","); n++; - *lp = l; } - l = XREALLOC(*lp, n + 1, char *); + l = XREALLOC(l, n + 1, char *); l[n] = NULL; + *lp = l; return l;