diff options
| author | @syxhe <https://t.me/syxhe> | 2025-06-06 14:09:32 -0500 |
|---|---|---|
| committer | @syxhe <https://t.me/syxhe> | 2025-06-06 14:09:32 -0500 |
| commit | 5431fec6726c18234c9c28b014cc6f18a0d79884 (patch) | |
| tree | de2847fdc0858606b7d542c8470bb024ef27a42b /src/scanner.c | |
| parent | ec0cfdc492065dcce687797d3a931af105a461c8 (diff) | |
Style touchup
Diffstat (limited to 'src/scanner.c')
| -rw-r--r-- | src/scanner.c | 6 |
1 files changed, 4 insertions, 2 deletions
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 @@ | |||
| 11 | #include <error.h> | 11 | #include <error.h> |
| 12 | 12 | ||
| 13 | dlinkedlist * scandirlist(const char * const dir, int (*selector)(const struct dirent *), int (*cmp)(const struct dirent **, const struct dirent **)) { | 13 | dlinkedlist * scandirlist(const char * const dir, int (*selector)(const struct dirent *), int (*cmp)(const struct dirent **, const struct dirent **)) { |
| 14 | if(!dir || selector == NULL || cmp == NULL) ERRRET(EINVAL, NULL); | ||
| 15 | |||
| 14 | struct dirent **namelist = NULL; | 16 | struct dirent **namelist = NULL; |
| 15 | dlinkedlist *list = NULL; | 17 | dlinkedlist *list = NULL; |
| 16 | int numentries = -1; | 18 | int numentries = -1; |
| 17 | 19 | ||
| 18 | if((numentries = scandir(dir, &namelist, selector, cmp)) < 0) | 20 | if((numentries = scandir(dir, &namelist, selector, cmp)) < 0) |
| 19 | RETURNWERR(errno, NULL); | 21 | ERRRET(errno, NULL); |
| 20 | 22 | ||
| 21 | list = dlinkedlist_init(); | 23 | list = dlinkedlist_init(); |
| 22 | for(int i = 0; i < numentries; i++) | 24 | for(int i = 0; i < numentries; i++) |
| @@ -26,7 +28,7 @@ dlinkedlist * scandirlist(const char * const dir, int (*selector)(const struct d | |||
| 26 | free(namelist[j]); | 28 | free(namelist[j]); |
| 27 | 29 | ||
| 28 | free(namelist); | 30 | free(namelist); |
| 29 | RETURNWERR(errno, NULL); | 31 | ERRRET(errno, NULL); |
| 30 | } | 32 | } |
| 31 | free(namelist); | 33 | free(namelist); |
| 32 | 34 | ||
