ucx/string.c

changeset 69
fb59270b1de3
parent 68
88dbea299440
child 71
303dabadff1c
     1.1 --- a/ucx/string.c	Thu Oct 11 16:29:30 2012 +0200
     1.2 +++ b/ucx/string.c	Fri Oct 12 10:54:55 2012 +0200
     1.3 @@ -6,7 +6,7 @@
     1.4   */
     1.5  
     1.6  #include <stdlib.h>
     1.7 -#include <strings.h>
     1.8 +#include <string.h>
     1.9  #include <stdarg.h>
    1.10  
    1.11  #include "string.h"
    1.12 @@ -110,7 +110,7 @@
    1.13  
    1.14      /* special case: exact match - no processing needed */
    1.15      if (s.length == d.length && strncmp(s.ptr, d.ptr, s.length) == 0) {
    1.16 -        result = malloc(sizeof(sstr_t));
    1.17 +        result = (sstr_t*) malloc(sizeof(sstr_t));
    1.18          result[0] = sstrn("", 0);
    1.19          return result;
    1.20      }
    1.21 @@ -137,12 +137,12 @@
    1.22          }
    1.23          if ((*n) == nmax) break;
    1.24      }
    1.25 -    result = malloc(sizeof(sstr_t) * (*n));
    1.26 +    result = (sstr_t*) malloc(sizeof(sstr_t) * (*n));
    1.27  
    1.28      char *pptr = sv.ptr;
    1.29      for (int i = 0 ; i < *n ; i++) {
    1.30          size_t l = strlen(pptr);
    1.31 -        char* ptr = malloc(l + 1);
    1.32 +        char* ptr = (char*) malloc(l + 1);
    1.33          memcpy(ptr, pptr, l);
    1.34          ptr[l] = 0;
    1.35  

mercurial