From b033314bf1901d436dc71d41d5e1f37dda47e511 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Thu, 12 Dec 2024 16:03:08 +0100 Subject: formatting: Use clang-format on all projects This commit also add braces to all `if` statements. --- userland/libc/ctype/isalnum.c | 2 +- userland/libc/ctype/isalpha.c | 4 +++- userland/libc/ctype/isascii.c | 4 +++- userland/libc/ctype/isblank.c | 2 +- userland/libc/ctype/iscntrl.c | 5 ++--- userland/libc/ctype/isprint.c | 4 +++- userland/libc/ctype/ispunct.c | 2 +- userland/libc/ctype/tolower.c | 3 ++- userland/libc/ctype/toupper.c | 3 ++- 9 files changed, 18 insertions(+), 11 deletions(-) (limited to 'userland/libc/ctype') diff --git a/userland/libc/ctype/isalnum.c b/userland/libc/ctype/isalnum.c index 870728d..073b8bb 100644 --- a/userland/libc/ctype/isalnum.c +++ b/userland/libc/ctype/isalnum.c @@ -2,5 +2,5 @@ // This is probably the most useless libc function I have seen so far. int isalnum(int c) { - return isalpha(c) || isdigit(c); + return isalpha(c) || isdigit(c); } diff --git a/userland/libc/ctype/isalpha.c b/userland/libc/ctype/isalpha.c index 130f493..38c3cb4 100644 --- a/userland/libc/ctype/isalpha.c +++ b/userland/libc/ctype/isalpha.c @@ -1,4 +1,6 @@ #include // https://pubs.opengroup.org/onlinepubs/9699919799/functions/isalpha.html -int isalpha(int c) { return (('A' <= toupper(c)) && ('Z' >= toupper(c))); } +int isalpha(int c) { + return (('A' <= toupper(c)) && ('Z' >= toupper(c))); +} diff --git a/userland/libc/ctype/isascii.c b/userland/libc/ctype/isascii.c index 660c8bb..b598dde 100644 --- a/userland/libc/ctype/isascii.c +++ b/userland/libc/ctype/isascii.c @@ -1,4 +1,6 @@ #include // https://pubs.opengroup.org/onlinepubs/9699919799/functions/isascii.html -int isascii(int c) { return (c < 128); } +int isascii(int c) { + return (c < 128); +} diff --git a/userland/libc/ctype/isblank.c b/userland/libc/ctype/isblank.c index 488fa88..88ffa0b 100644 --- a/userland/libc/ctype/isblank.c +++ b/userland/libc/ctype/isblank.c @@ -1,5 +1,5 @@ #include int isblank(int c) { - return (c == ' ' || c == '\t'); + return (c == ' ' || c == '\t'); } diff --git a/userland/libc/ctype/iscntrl.c b/userland/libc/ctype/iscntrl.c index 92ed7f0..4fead0d 100644 --- a/userland/libc/ctype/iscntrl.c +++ b/userland/libc/ctype/iscntrl.c @@ -1,6 +1,5 @@ #include -int iscntrl(int c) -{ - return (unsigned)c < 0x20 || c == 0x7f; +int iscntrl(int c) { + return (unsigned)c < 0x20 || c == 0x7f; } diff --git a/userland/libc/ctype/isprint.c b/userland/libc/ctype/isprint.c index e6a3d0e..5504ebc 100644 --- a/userland/libc/ctype/isprint.c +++ b/userland/libc/ctype/isprint.c @@ -1,3 +1,5 @@ #include -int isprint(int c) { return c > 0x20 && 0x7F != c; } +int isprint(int c) { + return c > 0x20 && 0x7F != c; +} diff --git a/userland/libc/ctype/ispunct.c b/userland/libc/ctype/ispunct.c index 18dc7d8..abef66d 100644 --- a/userland/libc/ctype/ispunct.c +++ b/userland/libc/ctype/ispunct.c @@ -2,5 +2,5 @@ // https://pubs.opengroup.org/onlinepubs/9699919799/functions/ispunct.html int ispunct(int c) { - return (c == '.'); + return (c == '.'); } diff --git a/userland/libc/ctype/tolower.c b/userland/libc/ctype/tolower.c index f1bb163..c14ea54 100644 --- a/userland/libc/ctype/tolower.c +++ b/userland/libc/ctype/tolower.c @@ -1,7 +1,8 @@ #include int tolower(int c) { - if (c >= 'A' && c <= 'Z') + if (c >= 'A' && c <= 'Z') { return c - 'A' + 'a'; + } return c; } diff --git a/userland/libc/ctype/toupper.c b/userland/libc/ctype/toupper.c index 0f33886..599a0ff 100644 --- a/userland/libc/ctype/toupper.c +++ b/userland/libc/ctype/toupper.c @@ -1,7 +1,8 @@ #include int toupper(int c) { - if (c >= 'a' && c <= 'z') + if (c >= 'a' && c <= 'z') { return c - 'a' + 'A'; + } return c; } -- cgit v1.2.3