diff options
Diffstat (limited to 'userland/libc/dirent')
| -rw-r--r-- | userland/libc/dirent/scandir.c | 15 | 
1 files changed, 5 insertions, 10 deletions
diff --git a/userland/libc/dirent/scandir.c b/userland/libc/dirent/scandir.c index 945bc1f..564cbc8 100644 --- a/userland/libc/dirent/scandir.c +++ b/userland/libc/dirent/scandir.c @@ -2,11 +2,6 @@  #include <stdlib.h>  #include <string.h> -int nop_sel(const struct dirent *unused) { -  (void)unused; -  return 1; -} -  int nop_compar(const struct dirent **d1, const struct dirent **d2) {    *d2 = *d1;    return 0; @@ -15,9 +10,6 @@ int nop_compar(const struct dirent **d1, const struct dirent **d2) {  int scandir(const char *dir, struct dirent ***namelist,              int (*sel)(const struct dirent *),              int (*compar)(const struct dirent **, const struct dirent **)) { -  if (!sel) -    sel = nop_sel; -    if (!compar)      compar = nop_compar; @@ -28,8 +20,11 @@ int scandir(const char *dir, struct dirent ***namelist,    struct dirent *e;    int rc = 0;    for (; (e = readdir(d));) { -    if (!sel(e)) -      continue; +    if (sel) { +      if (!sel(e)) { +        continue; +      } +    }      struct dirent *p = malloc(sizeof(struct dirent));      memcpy(p, e, sizeof(struct dirent));      list = realloc(list, (rc + 1) * sizeof(struct dirent *));  |