diff options
author | aqua <aqua@iserlohn-fortress.net> | 2023-05-24 21:29:00 +0300 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2023-05-24 21:29:29 +0300 |
commit | 050aa3ab70dd69d1ca8ffe94fd146039a0885550 (patch) | |
tree | 4002a7a0bb86580cc6a2adc2eee45891ee068540 /lib/libk/stdio | |
parent | Place compiled objects and dependencies in build/ (diff) | |
download | kernel-050aa3ab70dd69d1ca8ffe94fd146039a0885550.tar.xz |
Make code ANSI C compatible
Diffstat (limited to 'lib/libk/stdio')
-rw-r--r-- | lib/libk/stdio/fprintf.c | 5 | ||||
-rw-r--r-- | lib/libk/stdio/printf.c | 5 | ||||
-rw-r--r-- | lib/libk/stdio/vfprintf.c | 5 |
3 files changed, 9 insertions, 6 deletions
diff --git a/lib/libk/stdio/fprintf.c b/lib/libk/stdio/fprintf.c index 9a96dc6..c088f54 100644 --- a/lib/libk/stdio/fprintf.c +++ b/lib/libk/stdio/fprintf.c @@ -1,11 +1,12 @@ #include <stdio.h> int -fprintf(FILE *restrict stream, const char *restrict format, ...) +fprintf(FILE *__restrict__ stream, const char *__restrict__ format, ...) { + int c = 0; va_list ap; va_start(ap, format); - int c = vfprintf(stream, format, ap); + c += vfprintf(stream, format, ap); va_end(ap); return c; } diff --git a/lib/libk/stdio/printf.c b/lib/libk/stdio/printf.c index 4efc1ac..4c45593 100644 --- a/lib/libk/stdio/printf.c +++ b/lib/libk/stdio/printf.c @@ -1,11 +1,12 @@ #include <stdio.h> int -printf(const char *restrict format, ...) +printf(const char *__restrict__ format, ...) { + int c = 0; va_list ap; va_start(ap, format); - int c = vfprintf(stdout, format, ap); + c += vfprintf(stdout, format, ap); va_end(ap); return c; } diff --git a/lib/libk/stdio/vfprintf.c b/lib/libk/stdio/vfprintf.c index d24e43e..a48600b 100644 --- a/lib/libk/stdio/vfprintf.c +++ b/lib/libk/stdio/vfprintf.c @@ -4,13 +4,14 @@ static char buffer[3 * sizeof(int) + 2]; int -vfprintf(FILE *restrict stream, const char *restrict format, va_list params) +vfprintf(FILE *__restrict__ stream, const char *__restrict__ format, va_list params) { int written = 0; + int i; int s = 0; int l = 0; - for (int i = 0; format[i] != '\0'; ++i) { + for (i = 0; format[i] != '\0'; ++i) { if (format[i] == '%') { written += stream->puts(stream, &format[s], l); s = i + 2; |