From 9a1f977e39d8e9fcb6a9cb2a612f4743e802221d Mon Sep 17 00:00:00 2001 From: Anton Kling Date: Fri, 10 Nov 2023 15:47:08 +0100 Subject: Kernel Style: Change uint*_t -> u* --- kernel/libc/include/string.h | 10 +++++----- kernel/libc/stdio/print.c | 4 ++-- kernel/libc/string/isequal.c | 2 +- kernel/libc/string/memcmp.c | 4 ++-- kernel/libc/string/memcpy.c | 8 ++++---- kernel/libc/string/memset.c | 4 ++-- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'kernel/libc') diff --git a/kernel/libc/include/string.h b/kernel/libc/include/string.h index 7cee4b2..707d391 100644 --- a/kernel/libc/include/string.h +++ b/kernel/libc/include/string.h @@ -1,16 +1,16 @@ #ifndef STRING_H #define STRING_H #include -#include +#include unsigned long strlen(const char *s); -void *memcpy(void *dest, const void *src, uint32_t n); -void *memset(void *dst, const unsigned char c, uint32_t n); -int memcmp(const void *s1, const void *s2, uint32_t n); +void *memcpy(void *dest, const void *src, u32 n); +void *memset(void *dst, const unsigned char c, u32 n); +int memcmp(const void *s1, const void *s2, u32 n); char *strcpy(char *d, const char *s); int strcmp(const char *s1, const char *s2); int isequal(const char *s1, const char *s2); -int isequal_n(const char *s1, const char *s2, uint32_t n); +int isequal_n(const char *s1, const char *s2, u32 n); char *copy_and_allocate_string(const char *s); char *copy_and_allocate_user_string(const char *s); char *strncpy(char *dest, const char *src, size_t n); diff --git a/kernel/libc/stdio/print.c b/kernel/libc/stdio/print.c index 8174983..f1a4918 100644 --- a/kernel/libc/stdio/print.c +++ b/kernel/libc/stdio/print.c @@ -10,7 +10,7 @@ const char HEX_SET[0x10] = {'0', '1', '2', '3', '4', '5', '6', '7', inline void putc(const char c) { write_serial(c); } -int kprint_hex(uint64_t num) { +int kprint_hex(u64 num) { int c = 2; if (num == 0) { @@ -79,7 +79,7 @@ int kprintf(const char *format, ...) { ; break; case 'x': - c += kprint_hex(va_arg(list, const uint32_t)); + c += kprint_hex(va_arg(list, const u32)); break; case '%': putc('%'); diff --git a/kernel/libc/string/isequal.c b/kernel/libc/string/isequal.c index cdbd3cc..75f7366 100644 --- a/kernel/libc/string/isequal.c +++ b/kernel/libc/string/isequal.c @@ -7,7 +7,7 @@ int isequal(const char *s1, const char *s2) { return 1; } -int isequal_n(const char *s1, const char *s2, uint32_t n) { +int isequal_n(const char *s1, const char *s2, u32 n) { for(;*s1 && n;s1++,s2++,n--) if(*s1 != *s2) return 0; diff --git a/kernel/libc/string/memcmp.c b/kernel/libc/string/memcmp.c index 72c680a..db13ed2 100644 --- a/kernel/libc/string/memcmp.c +++ b/kernel/libc/string/memcmp.c @@ -1,10 +1,10 @@ #include "../include/string.h" -int memcmp(const void *s1, const void *s2, uint32_t n) +int memcmp(const void *s1, const void *s2, u32 n) { int return_value = 0; - for(uint32_t i = 0;i < n;i++) + for(u32 i = 0;i < n;i++) if(((unsigned char *)(s1))[i] != ((unsigned char *)(s2))[i]) return_value++; diff --git a/kernel/libc/string/memcpy.c b/kernel/libc/string/memcpy.c index 5c04407..1313261 100644 --- a/kernel/libc/string/memcpy.c +++ b/kernel/libc/string/memcpy.c @@ -1,18 +1,18 @@ #include "../include/string.h" void * -memcpy(void *dest, const void *src, uint32_t n) { +memcpy(void *dest, const void *src, u32 n) { unsigned char *d = dest; const unsigned char *s = src; for (; n >= 8; n -= 8, d += 8, s += 8) - *(uint64_t *)d = *(uint64_t *)s; + *(u64 *)d = *(u64 *)s; for (; n >= 4; n -= 4, d += 4, s += 4) - *(uint32_t *)d = *(uint32_t *)s; + *(u32 *)d = *(u32 *)s; for (; n >= 2; n -= 2, d += 2, s += 2) - *(uint16_t *)d = *(uint16_t *)s; + *(u16 *)d = *(u16 *)s; for (; n; n--) *d++ = *s++; diff --git a/kernel/libc/string/memset.c b/kernel/libc/string/memset.c index a446eb4..5d7de62 100644 --- a/kernel/libc/string/memset.c +++ b/kernel/libc/string/memset.c @@ -1,8 +1,8 @@ #include -void *memset(void *dst, const unsigned char c, uint32_t n) { +void *memset(void *dst, const unsigned char c, u32 n) { uintptr_t d = (uintptr_t)dst; - for (uint32_t i = 0; i < n; i++, d++) + for (u32 i = 0; i < n; i++, d++) *(unsigned char *)d = c; return (void *)d; -- cgit v1.2.3