summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/fseek.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fseek.c')
-rw-r--r--lib/libc/stdio/fseek.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/lib/libc/stdio/fseek.c b/lib/libc/stdio/fseek.c
index 0e425e8e..7a6754f7 100644
--- a/lib/libc/stdio/fseek.c
+++ b/lib/libc/stdio/fseek.c
@@ -1,31 +1,30 @@
-#include "__stdio.h" // for _IO_EOF, _IO_ERR
+#include "__stdio.h" // for __FILE, _IO_EOF, _IO_ERR
#include "stddef.h" // for NULL
#include <atomic.h> // for LIBC_LOCK, LIBC_UNLOCK
-#include <libc.h> // for __IMPL
#include <stdio.h> // for FILE, fseek
#include <unistd.h> // for lseek, off_t
int fseek(FILE *stream, long offset, int whence)
{
- if (stream == NULL || __IMPL(stream)->fd < 0)
+ if (stream == NULL || __FILE(stream)->fd < 0)
return -1;
- LIBC_LOCK(__IMPL(stream)->lock);
+ LIBC_LOCK(__FILE(stream)->lock);
- __IMPL(stream)->buf_pos = 0;
- __IMPL(stream)->buf_len = 0;
- __IMPL(stream)->flags &= ~_IO_EOF;
+ __FILE(stream)->buf_pos = 0;
+ __FILE(stream)->buf_len = 0;
+ __FILE(stream)->flags &= ~_IO_EOF;
- off_t result = lseek(__IMPL(stream)->fd, offset, whence);
+ off_t result = lseek(__FILE(stream)->fd, offset, whence);
- LIBC_UNLOCK(__IMPL(stream)->lock);
+ LIBC_UNLOCK(__FILE(stream)->lock);
if (result == (off_t)-1) {
- __IMPL(stream)->flags |= _IO_ERR;
+ __FILE(stream)->flags |= _IO_ERR;
return -1;
}
- __IMPL(stream)->offset = result;
+ __FILE(stream)->offset = result;
return 0;
}