ucx/string.c

changeset 87
bd444539cced
parent 71
303dabadff1c
child 95
ecfdc1c4a552
     1.1 --- a/ucx/string.c	Mon Feb 25 13:25:07 2013 +0100
     1.2 +++ b/ucx/string.c	Mon Feb 25 16:26:50 2013 +0100
     1.3 @@ -161,11 +161,13 @@
     1.4  sstr_t sstrdup(sstr_t s) {
     1.5      sstr_t newstring;
     1.6      newstring.ptr = (char*) malloc(s.length + 1);
     1.7 -    if (newstring.ptr != NULL) {
     1.8 +    if (newstring.ptr) {
     1.9          newstring.length = s.length;
    1.10          newstring.ptr[newstring.length] = 0;
    1.11  
    1.12          memcpy(newstring.ptr, s.ptr, s.length);
    1.13 +    } else {
    1.14 +        newstring.length = 0;
    1.15      }
    1.16  
    1.17      return newstring;

mercurial