ucx/string.c

changeset 69
fb59270b1de3
parent 68
88dbea299440
child 71
303dabadff1c
--- a/ucx/string.c	Thu Oct 11 16:29:30 2012 +0200
+++ b/ucx/string.c	Fri Oct 12 10:54:55 2012 +0200
@@ -6,7 +6,7 @@
  */
 
 #include <stdlib.h>
-#include <strings.h>
+#include <string.h>
 #include <stdarg.h>
 
 #include "string.h"
@@ -110,7 +110,7 @@
 
     /* special case: exact match - no processing needed */
     if (s.length == d.length && strncmp(s.ptr, d.ptr, s.length) == 0) {
-        result = malloc(sizeof(sstr_t));
+        result = (sstr_t*) malloc(sizeof(sstr_t));
         result[0] = sstrn("", 0);
         return result;
     }
@@ -137,12 +137,12 @@
         }
         if ((*n) == nmax) break;
     }
-    result = malloc(sizeof(sstr_t) * (*n));
+    result = (sstr_t*) malloc(sizeof(sstr_t) * (*n));
 
     char *pptr = sv.ptr;
     for (int i = 0 ; i < *n ; i++) {
         size_t l = strlen(pptr);
-        char* ptr = malloc(l + 1);
+        char* ptr = (char*) malloc(l + 1);
         memcpy(ptr, pptr, l);
         ptr[l] = 0;
 

mercurial