version 1.144, 2020/01/23 07:10:22 |
version 1.145, 2020/01/24 23:54:40 |
|
|
return (r); |
return (r); |
} |
} |
|
|
|
/* |
|
* Extend string *sp by the specified format. If *sp is not NULL (or empty), |
|
* then the separator 'sep' will be prepended before the formatted arguments. |
|
* Extended strings are heap allocated. |
|
*/ |
|
void |
|
xextendf(char **sp, const char *sep, const char *fmt, ...) |
|
{ |
|
va_list ap; |
|
char *tmp1, *tmp2; |
|
|
|
va_start(ap, fmt); |
|
xvasprintf(&tmp1, fmt, ap); |
|
va_end(ap); |
|
|
|
if (*sp == NULL || **sp == '\0') { |
|
free(*sp); |
|
*sp = tmp1; |
|
return; |
|
} |
|
xasprintf(&tmp2, "%s%s%s", *sp, sep == NULL ? "" : sep, tmp1); |
|
free(tmp1); |
|
free(*sp); |
|
*sp = tmp2; |
|
} |
|
|
|
|
u_int64_t |
u_int64_t |
get_u64(const void *vp) |
get_u64(const void *vp) |
{ |
{ |