mirror of
git://git.musl-libc.org/musl
synced 2025-03-06 20:48:29 +01:00
this header evolved to facilitate the extremely lazy practice of omitting explicit includes of the necessary headers in individual stdio source files; not only was this sloppy, but it also increased build time. now, stdio_impl.h is only including the headers it needs for its own use; any further headers needed by source files are included directly where needed.
16 lines
349 B
C
16 lines
349 B
C
#include "stdio_impl.h"
|
|
#include <string.h>
|
|
|
|
size_t __string_read(FILE *f, unsigned char *buf, size_t len)
|
|
{
|
|
char *src = f->cookie;
|
|
size_t k = len+256;
|
|
char *end = memchr(src, 0, k);
|
|
if (end) k = end-src;
|
|
if (k < len) len = k;
|
|
memcpy(buf, src, len);
|
|
f->rpos = (void *)(src+len);
|
|
f->rend = (void *)(src+k);
|
|
f->cookie = src+k;
|
|
return len;
|
|
}
|