未验证 提交 692a1ab9 编写于 作者: O openharmony_ci 提交者: Gitee

!1001 Optimize sscanf

Merge pull request !1001 from yinchuang/opt_sscanf
......@@ -2192,6 +2192,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.
先完成此消息的编辑!
想要评论请 注册