summaryrefslogtreecommitdiff
path: root/src/shared/mem.c
diff options
context:
space:
mode:
authordzwdz2021-11-14 18:04:38 +0100
committerdzwdz2021-11-14 18:04:38 +0100
commitd2df6a9c064965b62c8b966bb93a81b663b35395 (patch)
tree6cea8db7ef1901ebf0923e8dab42efd26513155d /src/shared/mem.c
parent7acf810e81491b08410df1b7bb886bd11b44cd98 (diff)
shared: move the str* implementations to shared/mem.c
Diffstat (limited to 'src/shared/mem.c')
-rw-r--r--src/shared/mem.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/shared/mem.c b/src/shared/mem.c
index 1b483fe..9185c9e 100644
--- a/src/shared/mem.c
+++ b/src/shared/mem.c
@@ -26,3 +26,20 @@ void *memset(void *s, int c, size_t n) {
s2[i] = c;
return s;
}
+
+int strcmp(const char *s1, const char *s2) {
+ while (*s1) {
+ if (*s1 != *s2) {
+ if (*s1 < *s2) return -1;
+ else return 1;
+ }
+ s1++; s2++;
+ }
+ return 0;
+}
+
+size_t strlen(const char *s) {
+ size_t c = 0;
+ while (*s++) c++;
+ return c;
+}