diff options
| author | Kacper <kacper@mail.openlinux.dev> | 2025-12-25 15:13:54 +0100 |
|---|---|---|
| committer | Kacper <kacper@mail.openlinux.dev> | 2025-12-25 15:13:54 +0100 |
| commit | 8834571b202cf4dc9c649cfb096c213b6ecf1566 (patch) | |
| tree | 1cde1c0f0b823391d3d289ac89591c13be8cbb3b /lib/libc/dirent/fdopendir.c | |
| parent | 46fadf4bf14360be046b9b770ddf205fad96a0a7 (diff) | |
Move __dirent.h to libc/dirent.h
Diffstat (limited to 'lib/libc/dirent/fdopendir.c')
| -rw-r--r-- | lib/libc/dirent/fdopendir.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libc/dirent/fdopendir.c b/lib/libc/dirent/fdopendir.c index c0e3492b..145d7404 100644 --- a/lib/libc/dirent/fdopendir.c +++ b/lib/libc/dirent/fdopendir.c @@ -1,20 +1,22 @@ #include "stddef.h" // for NULL -#include <__dirent.h> // for __DIR -#include <dirent.h> // for DIR, fdopendir -#include <errno.h> // for EBADF, errno -#include <stdlib.h> // for calloc +#include <dirent.h> +#include <errno.h> +#include <libc/dirent.h> +#include <stdlib.h> +#include <sys/cdefs.h> DIR *fdopendir(int fildes) { struct __DIR *dir; - if (fildes < 0) { + if (__predict_false(fildes < 0)) { errno = EBADF; return NULL; } - if ((dir = calloc(1, sizeof(struct __DIR))) == NULL) { + dir = calloc(1, sizeof(struct __DIR)); + if (__predict_false(dir == NULL)) { return NULL; } |
