summaryrefslogtreecommitdiff
path: root/src/stdio
diff options
context:
space:
mode:
Diffstat (limited to 'src/stdio')
-rw-r--r--src/stdio/snprintf.c14
-rw-r--r--src/stdio/vfscanf.c12
-rw-r--r--src/stdio/vsnprintf.c14
-rw-r--r--src/stdio/vsscanf.c12
4 files changed, 27 insertions, 25 deletions
diff --git a/src/stdio/snprintf.c b/src/stdio/snprintf.c
index 44bb65fe..a6896c8a 100644
--- a/src/stdio/snprintf.c
+++ b/src/stdio/snprintf.c
@@ -4,15 +4,17 @@
int snprintf(char * restrict s, size_t n, const char * restrict format, ...)
{
- int ret = 0;
+ struct io_options opt = {
+ .fnname = __func__,
+ .string = s,
+ .maxlen = n,
+ };
+
va_list ap;
- struct io_options opt = {0};
- opt.fnname = __func__;
- opt.string = s;
- opt.maxlen = n;
va_start(ap, format);
- ret = __printf(&opt, format, ap);
+ int ret = __printf(&opt, format, ap);
va_end(ap);
+
return ret;
}
diff --git a/src/stdio/vfscanf.c b/src/stdio/vfscanf.c
index ad9f5614..99053885 100644
--- a/src/stdio/vfscanf.c
+++ b/src/stdio/vfscanf.c
@@ -3,12 +3,12 @@
int vfscanf(FILE * restrict stream, const char * restrict format, va_list arg)
{
- int ret = 0;
- struct io_options opt = {0};
- opt.fnname = __func__;
- opt.stream = stream;
- ret = __scanf(&opt, format, arg);
- return ret;
+ struct io_options opt = {
+ .fnname = __func__,
+ .stream = stream,
+ };
+
+ return __scanf(&opt, format, arg);
}
/*
diff --git a/src/stdio/vsnprintf.c b/src/stdio/vsnprintf.c
index 62963b2c..92753a90 100644
--- a/src/stdio/vsnprintf.c
+++ b/src/stdio/vsnprintf.c
@@ -4,13 +4,13 @@
int vsnprintf(char * restrict s, size_t n, const char *format, va_list arg)
{
- int ret = 0;
- struct io_options opt = {0};
- opt.fnname = "fprintf";
- opt.string = s;
- opt.maxlen = n;
- ret = __printf(&opt, format, arg);
- return ret;
+ struct io_options opt = {
+ .fnname = __func__,
+ .string = s,
+ .maxlen = n,
+ };
+
+ return __printf(&opt, format, arg);
}
/*
diff --git a/src/stdio/vsscanf.c b/src/stdio/vsscanf.c
index 2573b213..dcf40db8 100644
--- a/src/stdio/vsscanf.c
+++ b/src/stdio/vsscanf.c
@@ -4,12 +4,12 @@
int vsscanf(const char * restrict s, const char * restrict format, va_list arg)
{
- int ret = 0;
- struct io_options opt = {0};
- opt.fnname = __func__;
- opt.string = (char*)s;
- ret = __scanf(&opt, format, arg);
- return ret;
+ struct io_options opt = {
+ .fnname = __func__,
+ .string = (char*)s,
+ };
+
+ return __scanf(&opt, format, arg);
}
/*