Add helper function tvh_str_update()

This commit is contained in:
Andreas Öman 2008-09-06 19:07:47 +00:00
parent 7ee88c5577
commit a203977f89
2 changed files with 14 additions and 0 deletions

13
main.c
View file

@ -419,3 +419,16 @@ tvh_str_set(char **strp, const char *src)
*strp = src ? strdup(src) : NULL;
}
/**
*
*/
void
tvh_str_update(char **strp, const char *src)
{
if(src == NULL)
return;
free(*strp);
*strp = strdup(src);
}

View file

@ -906,6 +906,7 @@ static inline unsigned int tvh_strhash(const char *s, unsigned int mod)
#define MAX(a,b) ((a) > (b) ? (a) : (b))
void tvh_str_set(char **strp, const char *src);
void tvh_str_update(char **strp, const char *src);
void tvhlog(int severity, const char *subsys, const char *fmt, ...);