rewrite the device subsystem interfaces (#48)
[lunaix-os.git] / lunaix-os / libs / klibc / string / trim.c
index c15e159a94b9c6809c4d58926f990a03417a02d6..82fbacc8622b85b642fe414874af3738d82a3a29 100644 (file)
@@ -1,9 +1,10 @@
 #include <klibc/string.h>
+#include <lunaix/compiler.h>
 
 #define WS_CHAR(c)                                                             \
     (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v' || c == '\r')
 
-void
+void _weak
 strrtrim(char* str)
 {
     unsigned long l = strlen(str);
@@ -18,7 +19,7 @@ strrtrim(char* str)
     str[l + 1] = '\0';
 }
 
-char*
+char* _weak
 strltrim_safe(char* str)
 {
     unsigned long l = 0;
@@ -27,7 +28,7 @@ strltrim_safe(char* str)
         l++;
     }
 
-    if (!l)
-        return str;
-    return strcpy(str, str + l);
+    if (l)
+        strcpy(str, str + l);
+    return str;
 }
\ No newline at end of file