summaryrefslogtreecommitdiff
path: root/userland/libc/string/sscanf.c
diff options
context:
space:
mode:
authorAnton Kling <anton@kling.gg>2024-12-12 16:03:08 +0100
committerAnton Kling <anton@kling.gg>2024-12-12 16:03:08 +0100
commitb033314bf1901d436dc71d41d5e1f37dda47e511 (patch)
tree120bd137888a7f96904a47af7d20422608ffe225 /userland/libc/string/sscanf.c
parentdcbcdbdc5bcfb86eca05fb655e3bf009d89e39e0 (diff)
formatting: Use clang-format on all projects
This commit also add braces to all `if` statements.
Diffstat (limited to 'userland/libc/string/sscanf.c')
-rw-r--r--userland/libc/string/sscanf.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/userland/libc/string/sscanf.c b/userland/libc/string/sscanf.c
index e1ede63..8a3ed0e 100644
--- a/userland/libc/string/sscanf.c
+++ b/userland/libc/string/sscanf.c
@@ -38,8 +38,9 @@ long ftnum(FILE *stream, int base, int *error) {
return 0;
}
for (;;) {
- if (EOF == (c = fgetc(stream)))
+ if (EOF == (c = fgetc(stream))) {
break;
+ }
if (c == '\0') {
ungetc(c, stream);
break;
@@ -69,13 +70,15 @@ int vfscanf(FILE *stream, const char *format, va_list ap) {
for (; *format; format++) {
if (*format != '%' && !cont) {
char c;
- if (isspace(*format))
+ if (isspace(*format)) {
continue;
+ }
if (EOF == (c = fgetc(stream))) {
break;
}
- if (*format == c) // TODO: Make sure this is the correct behaviour
+ if (*format == c) { // TODO: Make sure this is the correct behaviour
continue;
+ }
// TODO: Make sure this is the correct behaviour
errno = EINVAL;
assert(0);
@@ -164,8 +167,9 @@ size_t sscanf_read(FILE *f, unsigned char *s, size_t l) {
s++;
r++;
}
- if (!(*(c->s + c->offset)))
+ if (!(*(c->s + c->offset))) {
f->is_eof = 1;
+ }
/*
memcpy(s, c->s, l);
c->s += l;*/