ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/libstatgrab/src/libstatgrab/tools.c
(Generate patch)

Comparing projects/libstatgrab/src/libstatgrab/tools.c (file contents):
Revision 1.41 by ats, Mon Apr 5 15:40:15 2004 UTC vs.
Revision 1.42 by ats, Mon Apr 5 18:10:11 2004 UTC

# Line 403 | Line 403 | size_t sg_strlcat(char *dst, const char *src, size_t s
403          return(dlen + (s - src));       /* count does not include NUL */
404   }
405  
406 < char *sg_update_string(char **dest, const char *src) {
406 > int sg_update_string(char **dest, const char *src) {
407          char *new;
408  
409 +        if (src == NULL) {
410 +                /* We're being told to set it to NULL. */
411 +                free(*dest);
412 +                *dest = NULL;
413 +                return 0;
414 +        }
415 +
416          new = realloc(*dest, strlen(src) + 1);
417          if (new == NULL) {
418 <                return NULL;
418 >                return -1;
419          }
420  
421          strcpy(new, src);
422          *dest = new;
423 <        return new;
423 >        return 0;
424   }
425  
426   long long sg_get_ll_match(char *line, regmatch_t *match){

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines