summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fdopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fdopen.c')
-rw-r--r--lib/libc/stdio/fdopen.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c
index f762a83d..c5db3854 100644
--- a/lib/libc/stdio/fdopen.c
+++ b/lib/libc/stdio/fdopen.c
@@ -1,9 +1,8 @@
-#include "__stdio.h" // for __libc_fadd
+#include "__stdio.h" // for __FILE, __libc_fadd
#include "features.h" // for __weak
#include "stdatomic.h" // for atomic_flag_clear
#include "stddef.h" // for NULL
-#include <libc.h> // for __IMPL
#include <stdio.h> // for FILE, _IONBF, SEEK_END, _IOLBF, fdopen
#include <stdlib.h> // for calloc, free
#include <unistd.h> // for lseek, off_t
@@ -21,17 +20,18 @@ FILE *fdopen(int fildes, const char *mode)
return NULL;
}
- if ((stream = calloc(1, sizeof(FILE))) == NULL)
+ stream = calloc(1, sizeof(FILE));
+ if (stream == NULL)
return NULL;
- __IMPL(stream)->fd = fildes;
- atomic_flag_clear(&__IMPL(stream)->lock);
+ __FILE(stream)->fd = fildes;
+ atomic_flag_clear(&__FILE(stream)->lock);
if (mode[0] == 'r') {
- __IMPL(stream)->type = _IONBF;
+ __FILE(stream)->type = _IONBF;
} else if (mode[0] == 'w') {
- __IMPL(stream)->type = _IOLBF;
+ __FILE(stream)->type = _IOLBF;
} else if (mode[0] == 'a') {
- __IMPL(stream)->type = _IONBF;
+ __FILE(stream)->type = _IONBF;
off_t offset = lseek(fildes, 0, SEEK_END);
if (offset == (off_t)-1) {