mirror of https://git.musl-libc.org/git/musl
Browse Source
apparently this function was intended at some point to be used by strto* family as well, and thus was put in its own file; however, as far as I can tell, it's only ever been used by vsscanf. move it to the same file to reduce the number of source files and external symbols.master
3 changed files with 13 additions and 21 deletions
@ -1,16 +0,0 @@ |
|||||
#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; |
|
||||
} |
|
||||
Loading…
Reference in new issue