Skip to content

Commit

Permalink
perf tools: Remove unused perf_pathdup, xstrdup functions
Browse files Browse the repository at this point in the history
Cc: Adrian Hunter <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Wang Nan <[email protected]>
Link: http://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
acmel committed Mar 23, 2016
1 parent 531d241 commit cf47a8a
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 46 deletions.
3 changes: 0 additions & 3 deletions tools/perf/util/cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,4 @@ char *strip_path_suffix(const char *path, const char *suffix);
char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));

char *perf_pathdup(const char *fmt, ...)
__attribute__((format (printf, 1, 2)));

#endif /* __PERF_CACHE_H */
30 changes: 0 additions & 30 deletions tools/perf/util/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,36 +41,6 @@ static char *cleanup_path(char *path)
return path;
}

static char *perf_vsnpath(char *buf, size_t n, const char *fmt, va_list args)
{
const char *perf_dir = get_perf_dir();
size_t len;

len = strlen(perf_dir);
if (n < len + 1)
goto bad;
memcpy(buf, perf_dir, len);
if (len && !is_dir_sep(perf_dir[len-1]))
buf[len++] = '/';
len += vsnprintf(buf + len, n - len, fmt, args);
if (len >= n)
goto bad;
return cleanup_path(buf);
bad:
strlcpy(buf, bad_path, n);
return buf;
}

char *perf_pathdup(const char *fmt, ...)
{
char path[PATH_MAX];
va_list args;
va_start(args, fmt);
(void)perf_vsnpath(path, sizeof(path), fmt, args);
va_end(args);
return xstrdup(path);
}

char *mkpath(const char *fmt, ...)
{
va_list args;
Expand Down
1 change: 0 additions & 1 deletion tools/perf/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ static inline char *gitstrchrnul(const char *s, int c)
/*
* Wrappers:
*/
char *xstrdup(const char *str);
void *xrealloc(void *ptr, size_t size) __attribute__((weak));


Expand Down
12 changes: 0 additions & 12 deletions tools/perf/util/wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,6 @@ static inline void release_pack_memory(size_t size __maybe_unused,
{
}

char *xstrdup(const char *str)
{
char *ret = strdup(str);
if (!ret) {
release_pack_memory(strlen(str) + 1, -1);
ret = strdup(str);
if (!ret)
die("Out of memory, strdup failed");
}
return ret;
}

void *xrealloc(void *ptr, size_t size)
{
void *ret = realloc(ptr, size);
Expand Down

0 comments on commit cf47a8a

Please sign in to comment.