diff options
Diffstat (limited to 'tools/perf/util/string.c')
-rw-r--r-- | tools/perf/util/string.c | 24 |
1 files changed, 0 insertions, 24 deletions
diff --git a/tools/perf/util/string.c b/tools/perf/util/string.c index d87767f76903..6afd6106ceb5 100644 --- a/tools/perf/util/string.c +++ b/tools/perf/util/string.c | |||
@@ -357,27 +357,3 @@ void *memdup(const void *src, size_t len) | |||
357 | 357 | ||
358 | return p; | 358 | return p; |
359 | } | 359 | } |
360 | |||
361 | /** | ||
362 | * str_append - reallocate string and append another | ||
363 | * @s: pointer to string pointer | ||
364 | * @len: pointer to len (initialized) | ||
365 | * @a: string to append. | ||
366 | */ | ||
367 | int str_append(char **s, int *len, const char *a) | ||
368 | { | ||
369 | int olen = *s ? strlen(*s) : 0; | ||
370 | int nlen = olen + strlen(a) + 1; | ||
371 | if (*len < nlen) { | ||
372 | *len = *len * 2; | ||
373 | if (*len < nlen) | ||
374 | *len = nlen; | ||
375 | *s = realloc(*s, *len); | ||
376 | if (!*s) | ||
377 | return -ENOMEM; | ||
378 | if (olen == 0) | ||
379 | **s = 0; | ||
380 | } | ||
381 | strcat(*s, a); | ||
382 | return 0; | ||
383 | } | ||