/[monit]/monit/util.c
ViewVC logotype

Diff of /monit/util.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.84 by chopp, Wed Sep 3 15:29:29 2003 UTC revision 1.85 by hauk, Thu Sep 4 16:14:03 2003 UTC
# Line 271  char *replace_string(char **src, const c Line 271  char *replace_string(char **src, const c
271    {    {
272      char *p, *q;      char *p, *q;
273      int l= strlen(old);      int l= strlen(old);
274      char *buf;      char *buf= xmalloc(strlen(*src)+d+1);
   
     buf=xmalloc(strlen(*src)+d+1);  
275    
276      q= *src;      q= *src;
277      buf[0]= '\0';      *buf= 0;
278            
279      while((p= strstr(q, old))) {      while((p= strstr(q, old))) {
280                
# Line 290  char *replace_string(char **src, const c Line 288  char *replace_string(char **src, const c
288            
289      strcat(buf, q);      strcat(buf, q);
290      free(*src);      free(*src);
291      free(buf);      *src= buf;
     *src= xstrdup(buf);  
   
292    }    }
293    
294    return *src;    return *src;

Legend:
Removed from v.1.84  
changed lines
  Added in v.1.85

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26