From 5431fec6726c18234c9c28b014cc6f18a0d79884 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Fri, 6 Jun 2025 14:09:32 -0500 Subject: Style touchup --- src/scanner.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/scanner.c') diff --git a/src/scanner.c b/src/scanner.c index d20c714..ea35e3c 100644 --- a/src/scanner.c +++ b/src/scanner.c @@ -11,12 +11,14 @@ #include dlinkedlist * scandirlist(const char * const dir, int (*selector)(const struct dirent *), int (*cmp)(const struct dirent **, const struct dirent **)) { + if(!dir || selector == NULL || cmp == NULL) ERRRET(EINVAL, NULL); + struct dirent **namelist = NULL; dlinkedlist *list = NULL; int numentries = -1; if((numentries = scandir(dir, &namelist, selector, cmp)) < 0) - RETURNWERR(errno, NULL); + ERRRET(errno, NULL); list = dlinkedlist_init(); for(int i = 0; i < numentries; i++) @@ -26,7 +28,7 @@ dlinkedlist * scandirlist(const char * const dir, int (*selector)(const struct d free(namelist[j]); free(namelist); - RETURNWERR(errno, NULL); + ERRRET(errno, NULL); } free(namelist); -- cgit v1.2.3