From 0aa44015f4501f618280f095b4a4c477e69b3541 Mon Sep 17 00:00:00 2001 From: Loïc Guégan Date: Mon, 24 Mar 2025 09:53:41 +0100 Subject: Clean code --- src/libs/utils.c | 18 ++++++------------ src/libs/utils.h | 1 - 2 files changed, 6 insertions(+), 13 deletions(-) (limited to 'src/libs') diff --git a/src/libs/utils.c b/src/libs/utils.c index 75b5661..b6500ef 100644 --- a/src/libs/utils.c +++ b/src/libs/utils.c @@ -12,6 +12,7 @@ void memset(u8 *start, u8 value, u32 size){ } } +// The following implementation is incomplete int modulo(int dividend, int divisor){ while((dividend-divisor)>0){dividend-=divisor;} return dividend; @@ -21,14 +22,7 @@ int strlen(char * cp) { int len=0; while( cp[len++]) ; - return len - 1 ; //because it counted the zero which we don't want. -} - -int wordlen(char *s) -{ - int len=0; - while( *s!='\n' && *s!='\0' && *s!=' '){ s++; } - return len - 1 ; //because it counted the zero which we don't want. + return len - 1 ; } u8 strcmp(char *str1, char*str2){ @@ -43,11 +37,11 @@ u8 strcmp(char *str1, char*str2){ u8 strncmp(char *str1, char *str2, int n){ for(int i=0;i