From 8834571b202cf4dc9c649cfb096c213b6ecf1566 Mon Sep 17 00:00:00 2001 From: Kacper Date: Thu, 25 Dec 2025 15:13:54 +0100 Subject: Move __dirent.h to libc/dirent.h --- lib/libc/dirent/fdopendir.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'lib/libc/dirent/fdopendir.c') 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 // for DIR, fdopendir -#include // for EBADF, errno -#include // for calloc +#include +#include +#include +#include +#include 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; } -- cgit v1.2.3