diff options
author | H. Peter Anvin <hpa@linux.intel.com> | 2014-10-24 16:26:37 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@linux.intel.com> | 2014-10-24 16:26:37 -0400 |
commit | db65bcfd9563a7531c3dd46c350565705be1fd84 (patch) | |
tree | ff7b068472764e36ab02a739917e206dd11d6b46 /tools/perf/util/string.c | |
parent | b47dcbdc5161d3d5756f430191e2840d9b855492 (diff) | |
parent | f114040e3ea6e07372334ade75d1ee0775c355e1 (diff) |
Merge tag 'v3.18-rc1' into x86/urgent
Reason:
Need to apply audit patch on top of v3.18-rc1.
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
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 | } | ||