diff options
Diffstat (limited to 'kernel/libc/string')
| -rw-r--r-- | kernel/libc/string/isequal.c | 16 | ||||
| -rw-r--r-- | kernel/libc/string/memcmp.c | 13 | ||||
| -rw-r--r-- | kernel/libc/string/memcpy.c | 3 | ||||
| -rw-r--r-- | kernel/libc/string/strcmp.c | 9 | ||||
| -rw-r--r-- | kernel/libc/string/strlen.c | 10 | 
5 files changed, 24 insertions, 27 deletions
| 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;  } |