提交 8b57a815 编写于 作者: R Rich Felker

avoid depending on POSIX symbol in code used from plain C functions

上级 03de77f5
......@@ -3,7 +3,9 @@
size_t __string_read(FILE *f, unsigned char *buf, size_t len)
{
char *src = f->cookie;
size_t k = strnlen(src, len+256);
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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册