diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-16 16:10:46 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-06-21 12:18:33 -0400 |
commit | 814b3f5127248db90e5d9983668a44eec7b45c02 (patch) | |
tree | 2d1e015b22f7d8b35f505ca5c91af39718796ece | |
parent | 0102ef3ec940e8a68aa94125cd4b40569b24e6be (diff) |
perf tools: Remove some unused functions
Probably are there since the beginning, taken from git but never used.
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.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-lr65jeefffjeaywoapps9a6i@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
-rw-r--r-- | tools/perf/util/cache.h | 4 | ||||
-rw-r--r-- | tools/perf/util/config.c | 2 | ||||
-rw-r--r-- | tools/perf/util/path.c | 65 |
3 files changed, 2 insertions, 69 deletions
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index 0d814bb74661..f260040abc90 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h | |||
@@ -32,7 +32,6 @@ int perf_config_int(const char *, const char *); | |||
32 | u64 perf_config_u64(const char *, const char *); | 32 | u64 perf_config_u64(const char *, const char *); |
33 | int perf_config_bool(const char *, const char *); | 33 | int perf_config_bool(const char *, const char *); |
34 | int config_error_nonbool(const char *); | 34 | int config_error_nonbool(const char *); |
35 | const char *perf_config_dirname(const char *, const char *); | ||
36 | const char *perf_etc_perfconfig(void); | 35 | const char *perf_etc_perfconfig(void); |
37 | 36 | ||
38 | char *alias_lookup(const char *alias); | 37 | char *alias_lookup(const char *alias); |
@@ -45,9 +44,6 @@ static inline int is_absolute_path(const char *path) | |||
45 | return path[0] == '/'; | 44 | return path[0] == '/'; |
46 | } | 45 | } |
47 | 46 | ||
48 | char *strip_path_suffix(const char *path, const char *suffix); | ||
49 | |||
50 | char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); | 47 | char *mkpath(const char *fmt, ...) __attribute__((format (printf, 1, 2))); |
51 | char *perf_path(const char *fmt, ...) __attribute__((format (printf, 1, 2))); | ||
52 | 48 | ||
53 | #endif /* __PERF_CACHE_H */ | 49 | #endif /* __PERF_CACHE_H */ |
diff --git a/tools/perf/util/config.c b/tools/perf/util/config.c index 31e09a4e8862..d15c59267644 100644 --- a/tools/perf/util/config.c +++ b/tools/perf/util/config.c | |||
@@ -372,7 +372,7 @@ int perf_config_bool(const char *name, const char *value) | |||
372 | return !!perf_config_bool_or_int(name, value, &discard); | 372 | return !!perf_config_bool_or_int(name, value, &discard); |
373 | } | 373 | } |
374 | 374 | ||
375 | const char *perf_config_dirname(const char *name, const char *value) | 375 | static const char *perf_config_dirname(const char *name, const char *value) |
376 | { | 376 | { |
377 | if (!name) | 377 | if (!name) |
378 | return NULL; | 378 | return NULL; |
diff --git a/tools/perf/util/path.c b/tools/perf/util/path.c index 3bf6bf82ff2d..cff8bf0f87e8 100644 --- a/tools/perf/util/path.c +++ b/tools/perf/util/path.c | |||
@@ -14,14 +14,8 @@ | |||
14 | 14 | ||
15 | static char bad_path[] = "/bad-path/"; | 15 | static char bad_path[] = "/bad-path/"; |
16 | /* | 16 | /* |
17 | * Two hacks: | 17 | * One hack: |
18 | */ | 18 | */ |
19 | |||
20 | static const char *get_perf_dir(void) | ||
21 | { | ||
22 | return "."; | ||
23 | } | ||
24 | |||
25 | static char *get_pathname(void) | 19 | static char *get_pathname(void) |
26 | { | 20 | { |
27 | static char pathname_array[4][PATH_MAX]; | 21 | static char pathname_array[4][PATH_MAX]; |
@@ -54,60 +48,3 @@ char *mkpath(const char *fmt, ...) | |||
54 | return bad_path; | 48 | return bad_path; |
55 | return cleanup_path(pathname); | 49 | return cleanup_path(pathname); |
56 | } | 50 | } |
57 | |||
58 | char *perf_path(const char *fmt, ...) | ||
59 | { | ||
60 | const char *perf_dir = get_perf_dir(); | ||
61 | char *pathname = get_pathname(); | ||
62 | va_list args; | ||
63 | unsigned len; | ||
64 | |||
65 | len = strlen(perf_dir); | ||
66 | if (len > PATH_MAX-100) | ||
67 | return bad_path; | ||
68 | memcpy(pathname, perf_dir, len); | ||
69 | if (len && perf_dir[len-1] != '/') | ||
70 | pathname[len++] = '/'; | ||
71 | va_start(args, fmt); | ||
72 | len += vsnprintf(pathname + len, PATH_MAX - len, fmt, args); | ||
73 | va_end(args); | ||
74 | if (len >= PATH_MAX) | ||
75 | return bad_path; | ||
76 | return cleanup_path(pathname); | ||
77 | } | ||
78 | |||
79 | /* strip arbitrary amount of directory separators at end of path */ | ||
80 | static inline int chomp_trailing_dir_sep(const char *path, int len) | ||
81 | { | ||
82 | while (len && is_dir_sep(path[len - 1])) | ||
83 | len--; | ||
84 | return len; | ||
85 | } | ||
86 | |||
87 | /* | ||
88 | * If path ends with suffix (complete path components), returns the | ||
89 | * part before suffix (sans trailing directory separators). | ||
90 | * Otherwise returns NULL. | ||
91 | */ | ||
92 | char *strip_path_suffix(const char *path, const char *suffix) | ||
93 | { | ||
94 | int path_len = strlen(path), suffix_len = strlen(suffix); | ||
95 | |||
96 | while (suffix_len) { | ||
97 | if (!path_len) | ||
98 | return NULL; | ||
99 | |||
100 | if (is_dir_sep(path[path_len - 1])) { | ||
101 | if (!is_dir_sep(suffix[suffix_len - 1])) | ||
102 | return NULL; | ||
103 | path_len = chomp_trailing_dir_sep(path, path_len); | ||
104 | suffix_len = chomp_trailing_dir_sep(suffix, suffix_len); | ||
105 | } | ||
106 | else if (path[--path_len] != suffix[--suffix_len]) | ||
107 | return NULL; | ||
108 | } | ||
109 | |||
110 | if (path_len && !is_dir_sep(path[path_len - 1])) | ||
111 | return NULL; | ||
112 | return strndup(path, chomp_trailing_dir_sep(path, path_len)); | ||
113 | } | ||