From d07fa25e04a19ccb9aa25bb6e2156d23d213db77 Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Tue, 28 Nov 2023 20:11:05 +0100 Subject: Meta: Apply new clang-format rules to kernel --- kernel/libc/include/types.h | 4 ++-- kernel/libc/stdio/print.c | 8 ++++++-- kernel/libc/string/isequal.c | 16 ++++++++-------- kernel/libc/string/memcmp.c | 13 ++++++------- kernel/libc/string/memcpy.c | 3 +-- kernel/libc/string/strcmp.c | 9 ++++----- kernel/libc/string/strlen.c | 10 +++++----- 7 files changed, 32 insertions(+), 31 deletions(-) (limited to 'kernel/libc') diff --git a/kernel/libc/include/types.h b/kernel/libc/include/types.h index ffcf281..d9bede0 100644 --- a/kernel/libc/include/types.h +++ b/kernel/libc/include/types.h @@ -16,12 +16,12 @@ typedef int dev_t; typedef unsigned int fsblkcnt_t; typedef unsigned int fsfilcnt_t; typedef unsigned int ino_t; -//typedef unsigned int size_t; +// typedef unsigned int size_t; typedef int blksize_t; typedef int pid_t; typedef int ssize_t; -//typedef int clock_t; +// typedef int clock_t; typedef int time_t; #endif diff --git a/kernel/libc/stdio/print.c b/kernel/libc/stdio/print.c index f1a4918..fe50f50 100644 --- a/kernel/libc/stdio/print.c +++ b/kernel/libc/stdio/print.c @@ -8,7 +8,9 @@ const char HEX_SET[0x10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}; -inline void putc(const char c) { write_serial(c); } +inline void putc(const char c) { + write_serial(c); +} int kprint_hex(u64 num) { int c = 2; @@ -94,4 +96,6 @@ int kprintf(const char *format, ...) { return c; } -int puts(char *str) { return kprintf("%s\n", str); } +int puts(char *str) { + return kprintf("%s\n", str); +} diff --git a/kernel/libc/string/isequal.c b/kernel/libc/string/isequal.c index 75f7366..90712db 100644 --- a/kernel/libc/string/isequal.c +++ b/kernel/libc/string/isequal.c @@ -1,15 +1,15 @@ #include "../include/string.h" int isequal(const char *s1, const char *s2) { - for(;*s1;s1++,s2++) - if(*s1 != *s2) - return 0; - return 1; + for (; *s1; s1++, s2++) + if (*s1 != *s2) + return 0; + return 1; } int isequal_n(const char *s1, const char *s2, u32 n) { - for(;*s1 && n;s1++,s2++,n--) - if(*s1 != *s2) - return 0; - return 1; + for (; *s1 && n; s1++, s2++, n--) + if (*s1 != *s2) + return 0; + return 1; } diff --git a/kernel/libc/string/memcmp.c b/kernel/libc/string/memcmp.c index db13ed2..deeb029 100644 --- a/kernel/libc/string/memcmp.c +++ b/kernel/libc/string/memcmp.c @@ -1,12 +1,11 @@ #include "../include/string.h" -int memcmp(const void *s1, const void *s2, u32 n) -{ - int return_value = 0; +int memcmp(const void *s1, const void *s2, u32 n) { + int return_value = 0; - for(u32 i = 0;i < n;i++) - if(((unsigned char *)(s1))[i] != ((unsigned char *)(s2))[i]) - return_value++; + for (u32 i = 0; i < n; i++) + if (((unsigned char *)(s1))[i] != ((unsigned char *)(s2))[i]) + return_value++; - return return_value; + return return_value; } diff --git a/kernel/libc/string/memcpy.c b/kernel/libc/string/memcpy.c index 1313261..8b03536 100644 --- a/kernel/libc/string/memcpy.c +++ b/kernel/libc/string/memcpy.c @@ -1,7 +1,6 @@ #include "../include/string.h" -void * -memcpy(void *dest, const void *src, u32 n) { +void *memcpy(void *dest, const void *src, u32 n) { unsigned char *d = dest; const unsigned char *s = src; diff --git a/kernel/libc/string/strcmp.c b/kernel/libc/string/strcmp.c index d7039e2..c1b1432 100644 --- a/kernel/libc/string/strcmp.c +++ b/kernel/libc/string/strcmp.c @@ -1,8 +1,7 @@ #include "../include/string.h" -int strcmp(const char *s1, const char *s2) -{ - for(;*s1 == *s2 && *s1; s1++, s2++) - ; - return *s1 - *s2; +int strcmp(const char *s1, const char *s2) { + for (; *s1 == *s2 && *s1; s1++, s2++) + ; + return *s1 - *s2; } diff --git a/kernel/libc/string/strlen.c b/kernel/libc/string/strlen.c index 4346383..a4a096a 100644 --- a/kernel/libc/string/strlen.c +++ b/kernel/libc/string/strlen.c @@ -1,8 +1,8 @@ #include "../include/string.h" -unsigned long strlen(const char *s) -{ - const char * tmp = s; - for(;*tmp++;); - return (tmp - s)-1; +unsigned long strlen(const char *s) { + const char *tmp = s; + for (; *tmp++;) + ; + return (tmp - s) - 1; } -- cgit v1.2.3