aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@redhat.com>2016-03-23 14:25:02 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2016-03-23 14:27:33 -0400
commitcf47a8aede9febee21cbd21d40a9c47244773a6c (patch)
tree954ece73f022c29ef84e08d39cf10a275c8b3a39
parent531d2410635ce290bee215f4bf9ec8ca98cf7302 (diff)
perf tools: Remove unused perf_pathdup, xstrdup functions
Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/n/tip-s87zi5d03m6rz622y1z6rlsa@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r--tools/perf/util/cache.h3
-rw-r--r--tools/perf/util/path.c30
-rw-r--r--tools/perf/util/util.h1
-rw-r--r--tools/perf/util/wrapper.c12
4 files changed, 0 insertions, 46 deletions
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h
index 17be38540404..da322bea56f7 100644
--- a/tools/perf/util/cache.h
+++ b/tools/perf/util/cache.h
@@ -70,7 +70,4 @@ char *strip_path_suffix(const char *path, const char *suffix);
70char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); 70char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
71char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); 71char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2)));
72 72
73char *perf_pathdup(const char *fmt, ...)
74 __attribute__((format (printf, 1, 2)));
75
76#endif /* __PERF_CACHE_H */ 73#endif /* __PERF_CACHE_H */
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c
index 3654d964e49d..3bf6bf82ff2d 100644
--- a/tools/perf/util/path.c
+++ b/tools/perf/util/path.c
@@ -41,36 +41,6 @@ static char *cleanup_path(char *path)
41 return path; 41 return path;
42} 42}
43 43
44static char *perf_vsnpath(char *buf, size_t n, const char *fmt, va_list args)
45{
46 const char *perf_dir = get_perf_dir();
47 size_t len;
48
49 len = strlen(perf_dir);
50 if (n < len + 1)
51 goto bad;
52 memcpy(buf, perf_dir, len);
53 if (len && !is_dir_sep(perf_dir[len-1]))
54 buf[len++] = '/';
55 len += vsnprintf(buf + len, n - len, fmt, args);
56 if (len >= n)
57 goto bad;
58 return cleanup_path(buf);
59bad:
60 strlcpy(buf, bad_path, n);
61 return buf;
62}
63
64char *perf_pathdup(const char *fmt, ...)
65{
66 char path[PATH_MAX];
67 va_list args;
68 va_start(args, fmt);
69 (void)perf_vsnpath(path, sizeof(path), fmt, args);
70 va_end(args);
71 return xstrdup(path);
72}
73
74char *mkpath(const char *fmt, ...) 44char *mkpath(const char *fmt, ...)
75{ 45{
76 va_list args; 46 va_list args;
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 835b8ceca041..8298d607c738 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -162,7 +162,6 @@ static inline char *gitstrchrnul(const char *s, int c)
162/* 162/*
163 * Wrappers: 163 * Wrappers:
164 */ 164 */
165char *xstrdup(const char *str);
166void *xrealloc(void *ptr, size_t size) __attribute__((weak)); 165void *xrealloc(void *ptr, size_t size) __attribute__((weak));
167 166
168 167
diff --git a/tools/perf/util/wrapper.c b/tools/perf/util/wrapper.c
index 19f15b650703..5f1a07c4b87b 100644
--- a/tools/perf/util/wrapper.c
+++ b/tools/perf/util/wrapper.c
@@ -12,18 +12,6 @@ static inline void release_pack_memory(size_t size __maybe_unused,
12{ 12{
13} 13}
14 14
15char *xstrdup(const char *str)
16{
17 char *ret = strdup(str);
18 if (!ret) {
19 release_pack_memory(strlen(str) + 1, -1);
20 ret = strdup(str);
21 if (!ret)
22 die("Out of memory, strdup failed");
23 }
24 return ret;
25}
26
27void *xrealloc(void *ptr, size_t size) 15void *xrealloc(void *ptr, size_t size)
28{ 16{
29 void *ret = realloc(ptr, size); 17 void *ret = realloc(ptr, size);