]> git.lizzy.rs Git - nothing.git/blobdiff - src/str.c
Use wrong_argument_type everywhere
[nothing.git] / src / str.c
index 4d7b08c5d405895581f2d2ebb7bcab47ad01f471..447fe25049370c1f7b150296ee5795bf3146c536 100644 (file)
--- a/src/str.c
+++ b/src/str.c
@@ -1,8 +1,11 @@
+#include <assert.h>
 #include <stdlib.h>
+#include <stdio.h>
 #include <string.h>
 #include <assert.h>
 
 #include "str.h"
+#include "system/nth_alloc.h"
 
 char *string_duplicate(const char *str,
                        const char *str_end)
@@ -12,7 +15,7 @@ char *string_duplicate(const char *str,
     }
 
     const size_t n = str_end == NULL ? strlen(str) : (size_t) (str_end - str);
-    char *dup_str = malloc(sizeof(char) * (n + 1));
+    char *dup_str = nth_alloc(sizeof(char) * (n + 1));
     if (dup_str == NULL) {
         return NULL;
     }
@@ -46,6 +49,6 @@ char *string_append(char *prefix, const char *suffix)
         return string_duplicate(suffix, NULL);
     }
 
-    prefix = realloc(prefix, strlen(prefix) + strlen(suffix) + 1);
+    prefix = nth_realloc(prefix, strlen(prefix) + strlen(suffix) + 1);
     return strcat(prefix, suffix);
 }