diff options
author | Freya Murphy <freya@freyacat.org> | 2025-04-03 23:04:38 -0400 |
---|---|---|
committer | Freya Murphy <freya@freyacat.org> | 2025-04-03 23:04:38 -0400 |
commit | d0854aa095421f225f7004cdcca0b8ad074303c5 (patch) | |
tree | d7c52aee6c0aa574e1b4230b5f28d49342470862 /lib | |
parent | load multiboot memory map, heap is done!!! (diff) | |
download | comus-d0854aa095421f225f7004cdcca0b8ad074303c5.tar.gz comus-d0854aa095421f225f7004cdcca0b8ad074303c5.tar.bz2 comus-d0854aa095421f225f7004cdcca0b8ad074303c5.zip |
fmt
Diffstat (limited to 'lib')
-rw-r--r-- | lib/memcpyv.c | 4 | ||||
-rw-r--r-- | lib/printf.c | 17 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lib/memcpyv.c b/lib/memcpyv.c index a4dcd22..610daf2 100644 --- a/lib/memcpyv.c +++ b/lib/memcpyv.c @@ -1,7 +1,7 @@ #include <string.h> -volatile void *memcpyv(volatile void *restrict dest, const volatile void *restrict src, - size_t n) +volatile void *memcpyv(volatile void *restrict dest, + const volatile void *restrict src, size_t n) { volatile char *d = dest; volatile const char *s = src; diff --git a/lib/printf.c b/lib/printf.c index d879c29..4a85956 100644 --- a/lib/printf.c +++ b/lib/printf.c @@ -286,10 +286,9 @@ static int printf_lltoa(char *buf, options_t *opts, bool is_neg, } } - // print zeros if needed if (opts->width_set && len < opts->width && opts->zero) { - while(len++ < opts->width) + while (len++ < opts->width) *(buf++) = '0'; } @@ -351,7 +350,8 @@ static void handle_char_specifier(context_t *ctx, data_t c) printf_putc(ctx, c.c); } -static void handle_string_specifier(context_t *ctx, options_t *opts, data_t data) +static void handle_string_specifier(context_t *ctx, options_t *opts, + data_t data) { char *str = data.str; int str_len = 0; @@ -460,7 +460,7 @@ static void do_printf(context_t *ctx, va_list args) // end int case 's': // read string - data.str = va_arg(args, void*); + data.str = va_arg(args, void *); break; // end string case 'c': @@ -585,15 +585,18 @@ void vfprintf(FILE *stream, const char *format, va_list args) do_printf(&ctx, args); } -void putc(char c) { +void putc(char c) +{ fputc(stdout, c); } -void puts(const char *str) { +void puts(const char *str) +{ fputs(stdout, str); } -void fputs(FILE *stream, const char *s) { +void fputs(FILE *stream, const char *s) +{ while (*s) fputc(stream, *s++); } |