提交 00057a37 编写于 作者: Y yinchuang

Optimize sscanf

Issue:I7NQ5W
Signed-off-by: Nyinchuang <yinchuang@huawei.com>
Test:libctest
上级 72969671
......@@ -2190,6 +2190,7 @@ musl_src_porting_file = [
"src/stdio/stderr.c",
"src/stdio/fgets.c",
"src/stdio/vsnprintf.c",
"src/stdio/vsscanf.c",
"src/internal/stdio_impl.h",
"src/internal/vdso.c",
"src/time/clock_gettime.c",
......
#include "stdio_impl.h"
#include <string.h>
// Empty implementation because vfscanf operates rpos directly.
static size_t string_read(FILE *f, unsigned char *buf, size_t len)
{
return 0;
}
int vsscanf(const char *restrict s, const char *restrict fmt, va_list ap)
{
size_t s_len = strlen(s);
FILE f = {
.buf = (void *)s, .cookie = (void *)s,
.read = string_read, .lock = -1,
.buf_size = s_len, .rpos = s, .rend = s + s_len,
};
return vfscanf(&f, fmt, ap);
}
weak_alias(vsscanf,__isoc99_vsscanf);
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册