From 0f30d227497418c6d3bef7d52244407e30454504 Mon Sep 17 00:00:00 2001 From: Kacper Date: Mon, 22 Dec 2025 23:27:56 +0100 Subject: Added c11 threads, fixed some locks and add *_unlocked functions --- lib/libc/stdio/fopen.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'lib/libc/stdio/fopen.c') diff --git a/lib/libc/stdio/fopen.c b/lib/libc/stdio/fopen.c index 5415e711..0265694a 100644 --- a/lib/libc/stdio/fopen.c +++ b/lib/libc/stdio/fopen.c @@ -8,10 +8,6 @@ #include #include // for close -__weak void __stdio_cleanup(void) -{ -} - FILE *fopen(const char *restrict pathname, const char *restrict mode) { int fd, flags, _mode; @@ -42,15 +38,15 @@ FILE *fopen(const char *restrict pathname, const char *restrict mode) if (stream == NULL) return NULL; - __FILE(stream)->fd = fd; - __FILE(stream)->buf_size = BUFSIZ; - __FILE(stream)->flags = flags; - __FILE(stream)->type = _IOLBF; - atomic_flag_clear(&__FILE(stream)->lock); + stream->fd = fd; + stream->buf_size = BUFSIZ; + stream->flags = flags; + stream->type = _IOLBF; + atomic_flag_clear(&stream->lock); - __FILE(stream)->buf = malloc(BUFSIZ); + stream->buf = malloc(BUFSIZ); - if (__FILE(stream)->buf == NULL) { + if (stream->buf == NULL) { close(fd); free(stream); return NULL; -- cgit v1.2.3