diff options
Diffstat (limited to 'src/kernel/lib/string')
-rw-r--r-- | src/kernel/lib/string/strcat.c | 9 | ||||
-rw-r--r-- | src/kernel/lib/string/strcati.c | 7 | ||||
-rw-r--r-- | src/kernel/lib/string/strcmp.c | 9 | ||||
-rw-r--r-- | src/kernel/lib/string/strcpy.c | 7 | ||||
-rw-r--r-- | src/kernel/lib/string/strdisp.c | 8 | ||||
-rw-r--r-- | src/kernel/lib/string/strdup.c | 8 | ||||
-rw-r--r-- | src/kernel/lib/string/strinv.c | 14 | ||||
-rw-r--r-- | src/kernel/lib/string/strlen.c | 7 |
8 files changed, 39 insertions, 30 deletions
diff --git a/src/kernel/lib/string/strcat.c b/src/kernel/lib/string/strcat.c index e0d6885..4328f87 100644 --- a/src/kernel/lib/string/strcat.c +++ b/src/kernel/lib/string/strcat.c @@ -2,9 +2,10 @@ void strcat(char *dest, const char *orig) { - size_t s_dest = strlen(dest); - size_t s_orig = strlen(orig); + size_t s_dest = strlen(dest); + size_t s_orig = strlen(orig); - for (size_t i = 0; i < s_orig; i++) dest[s_dest + i] = orig[i]; - dest[s_dest + s_orig] = 0; + for (size_t i = 0; i < s_orig; i++) + dest[s_dest + i] = orig[i]; + dest[s_dest + s_orig] = 0; }
\ No newline at end of file diff --git a/src/kernel/lib/string/strcati.c b/src/kernel/lib/string/strcati.c index 9ee3a43..5dab283 100644 --- a/src/kernel/lib/string/strcati.c +++ b/src/kernel/lib/string/strcati.c @@ -2,7 +2,8 @@ void strcati(char *dest, const char *orig) { - size_t s_orig = strlen(orig); - strdisp(dest, (int) s_orig); - for (size_t i = 0; i < s_orig; i++) dest[i] = orig[i]; + size_t s_orig = strlen(orig); + strdisp(dest, (int)s_orig); + for (size_t i = 0; i < s_orig; i++) + dest[i] = orig[i]; }
\ No newline at end of file diff --git a/src/kernel/lib/string/strcmp.c b/src/kernel/lib/string/strcmp.c index b8ac2a7..89f77a0 100644 --- a/src/kernel/lib/string/strcmp.c +++ b/src/kernel/lib/string/strcmp.c @@ -2,9 +2,12 @@ char strcmp(const char *a, const char *b) { - if (strlen(a) != strlen(b)) return 1; + if (strlen(a) != strlen(b)) + return 1; - for (size_t i = 0; i < strlen(a); i++) if (a[i] != b[i]) return 1; + for (size_t i = 0; i < strlen(a); i++) + if (a[i] != b[i]) + return 1; - return 0; + return 0; }
\ No newline at end of file diff --git a/src/kernel/lib/string/strcpy.c b/src/kernel/lib/string/strcpy.c index bab8535..6117e7c 100644 --- a/src/kernel/lib/string/strcpy.c +++ b/src/kernel/lib/string/strcpy.c @@ -2,8 +2,9 @@ void strcpy(char *dest, const char *orig) { - size_t s_orig = strlen(orig); + size_t s_orig = strlen(orig); - for (size_t i = 0; i < s_orig; i++) dest[i] = orig[i]; - dest[s_orig] = 0; + for (size_t i = 0; i < s_orig; i++) + dest[i] = orig[i]; + dest[s_orig] = 0; }
\ No newline at end of file diff --git a/src/kernel/lib/string/strdisp.c b/src/kernel/lib/string/strdisp.c index 36c03c3..e63f038 100644 --- a/src/kernel/lib/string/strdisp.c +++ b/src/kernel/lib/string/strdisp.c @@ -2,11 +2,13 @@ void strdisponce(char *str) { - for (size_t i = sizeof(str) + 2; i > 0; i--) str[i] = str[i - 1]; - str[0] = 0; + for (size_t i = sizeof(str) + 2; i > 0; i--) + str[i] = str[i - 1]; + str[0] = 0; } void strdisp(char *str, int n) { - for (int i = 0; i < n; i++) strdisponce(str); + for (int i = 0; i < n; i++) + strdisponce(str); }
\ No newline at end of file diff --git a/src/kernel/lib/string/strdup.c b/src/kernel/lib/string/strdup.c index e59dff4..82d14ef 100644 --- a/src/kernel/lib/string/strdup.c +++ b/src/kernel/lib/string/strdup.c @@ -3,8 +3,8 @@ char *strdup(const char *orig) { - size_t s_orig = strlen(orig); - char *ret = (char *) kmalloc(s_orig + 1); - strcpy(ret, orig); - return ret; + size_t s_orig = strlen(orig); + char *ret = (char *)kmalloc(s_orig + 1); + strcpy(ret, orig); + return ret; }
\ No newline at end of file diff --git a/src/kernel/lib/string/strinv.c b/src/kernel/lib/string/strinv.c index b4b4212..071a99d 100644 --- a/src/kernel/lib/string/strinv.c +++ b/src/kernel/lib/string/strinv.c @@ -2,12 +2,12 @@ void strinv(char *str) { - size_t s_str = strlen(str); + size_t s_str = strlen(str); - int iterations = (int) s_str / 2; - for (int i = 0; i < iterations; i++) { - char aux = str[i]; - str[i] = str[(s_str - i) - 1]; - str[(s_str - i) - 1] = aux; - } + int iterations = (int)s_str / 2; + for (int i = 0; i < iterations; i++) { + char aux = str[i]; + str[i] = str[(s_str - i) - 1]; + str[(s_str - i) - 1] = aux; + } }
\ No newline at end of file diff --git a/src/kernel/lib/string/strlen.c b/src/kernel/lib/string/strlen.c index 77e3c00..9e7e448 100644 --- a/src/kernel/lib/string/strlen.c +++ b/src/kernel/lib/string/strlen.c @@ -2,7 +2,8 @@ size_t strlen(const char *str) { - size_t len = 0; - while (str[len]) len++; - return len; + size_t len = 0; + while (str[len]) + len++; + return len; }
\ No newline at end of file |