diff options
Diffstat (limited to 'libc/stdio/open_memstream.c')
-rw-r--r-- | libc/stdio/open_memstream.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/libc/stdio/open_memstream.c b/libc/stdio/open_memstream.c index f750cd11c..25c2f9f61 100644 --- a/libc/stdio/open_memstream.c +++ b/libc/stdio/open_memstream.c @@ -5,10 +5,15 @@ * Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details. */ -#define fopencookie __fopencookie +#include <features.h> +#ifdef __USE_GNU #include "_stdio.h" +libc_hidden_proto(memcpy) +libc_hidden_proto(memset) +libc_hidden_proto(fopencookie) + #ifndef __UCLIBC_HAS_GLIBC_CUSTOM_STREAMS__ #error no custom streams! #endif @@ -53,7 +58,7 @@ static ssize_t oms_write(register void *cookie, const char *buf, size_t bufsize) } } - __memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); + memcpy(COOKIE->buf + COOKIE->pos, buf, bufsize); COOKIE->pos += bufsize; if (COOKIE->pos > COOKIE->eof) { @@ -92,7 +97,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) if (buf) { *COOKIE->bufloc = COOKIE->buf = buf; COOKIE->len = leastlen; - __memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ + memset(buf + COOKIE->eof, leastlen - COOKIE->eof, 0); /* 0-fill */ } else { /* TODO: check glibc errno setting... */ return -1; @@ -102,7 +107,7 @@ static int oms_seek(register void *cookie, __offmax_t *pos, int whence) *pos = COOKIE->pos = --leastlen; if (leastlen > COOKIE->eof) { - __memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); + memset(COOKIE->buf + COOKIE->eof, leastlen - COOKIE->eof, 0); *COOKIE->sizeloc = COOKIE->eof; } @@ -126,7 +131,8 @@ static const cookie_io_functions_t _oms_io_funcs = { * (ie replace the FILE buffer with the cookie buffer and update FILE bufstart, * etc. whenever we seek). */ -FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc) +libc_hidden_proto(open_memstream) +FILE *open_memstream(char **__restrict bufloc, size_t *__restrict sizeloc) { register __oms_cookie *cookie; register FILE *fp; @@ -162,4 +168,5 @@ FILE attribute_hidden *__open_memstream(char **__restrict bufloc, size_t *__rest return NULL; } -strong_alias(__open_memstream,open_memstream) +libc_hidden_def(open_memstream) +#endif |