diff options
Diffstat (limited to 'tools/perf/builtin-help.c')
-rw-r--r-- | tools/perf/builtin-help.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/tools/perf/builtin-help.c b/tools/perf/builtin-help.c index 4fb8734a796e..9f810b17c25c 100644 --- a/tools/perf/builtin-help.c +++ b/tools/perf/builtin-help.c | |||
@@ -61,8 +61,7 @@ static const char *get_man_viewer_info(const char *name) | |||
61 | { | 61 | { |
62 | struct man_viewer_info_list *viewer; | 62 | struct man_viewer_info_list *viewer; |
63 | 63 | ||
64 | for (viewer = man_viewer_info_list; viewer; viewer = viewer->next) | 64 | for (viewer = man_viewer_info_list; viewer; viewer = viewer->next) { |
65 | { | ||
66 | if (!strcasecmp(name, viewer->name)) | 65 | if (!strcasecmp(name, viewer->name)) |
67 | return viewer->info; | 66 | return viewer->info; |
68 | } | 67 | } |
@@ -115,7 +114,7 @@ static int check_emacsclient_version(void) | |||
115 | return 0; | 114 | return 0; |
116 | } | 115 | } |
117 | 116 | ||
118 | static void exec_woman_emacs(const char* path, const char *page) | 117 | static void exec_woman_emacs(const char *path, const char *page) |
119 | { | 118 | { |
120 | if (!check_emacsclient_version()) { | 119 | if (!check_emacsclient_version()) { |
121 | /* This works only with emacsclient version >= 22. */ | 120 | /* This works only with emacsclient version >= 22. */ |
@@ -129,7 +128,7 @@ static void exec_woman_emacs(const char* path, const char *page) | |||
129 | } | 128 | } |
130 | } | 129 | } |
131 | 130 | ||
132 | static void exec_man_konqueror(const char* path, const char *page) | 131 | static void exec_man_konqueror(const char *path, const char *page) |
133 | { | 132 | { |
134 | const char *display = getenv("DISPLAY"); | 133 | const char *display = getenv("DISPLAY"); |
135 | if (display && *display) { | 134 | if (display && *display) { |
@@ -157,7 +156,7 @@ static void exec_man_konqueror(const char* path, const char *page) | |||
157 | } | 156 | } |
158 | } | 157 | } |
159 | 158 | ||
160 | static void exec_man_man(const char* path, const char *page) | 159 | static void exec_man_man(const char *path, const char *page) |
161 | { | 160 | { |
162 | if (!path) | 161 | if (!path) |
163 | path = "man"; | 162 | path = "man"; |
@@ -180,7 +179,7 @@ static void add_man_viewer(const char *name) | |||
180 | 179 | ||
181 | while (*p) | 180 | while (*p) |
182 | p = &((*p)->next); | 181 | p = &((*p)->next); |
183 | *p = calloc(1, (sizeof(**p) + len + 1)); | 182 | *p = zalloc(sizeof(**p) + len + 1); |
184 | strncpy((*p)->name, name, len); | 183 | strncpy((*p)->name, name, len); |
185 | } | 184 | } |
186 | 185 | ||
@@ -195,7 +194,7 @@ static void do_add_man_viewer_info(const char *name, | |||
195 | size_t len, | 194 | size_t len, |
196 | const char *value) | 195 | const char *value) |
197 | { | 196 | { |
198 | struct man_viewer_info_list *new = calloc(1, sizeof(*new) + len + 1); | 197 | struct man_viewer_info_list *new = zalloc(sizeof(*new) + len + 1); |
199 | 198 | ||
200 | strncpy(new->name, name, len); | 199 | strncpy(new->name, name, len); |
201 | new->info = strdup(value); | 200 | new->info = strdup(value); |
@@ -364,9 +363,8 @@ static void show_man_page(const char *perf_cmd) | |||
364 | 363 | ||
365 | setup_man_path(); | 364 | setup_man_path(); |
366 | for (viewer = man_viewer_list; viewer; viewer = viewer->next) | 365 | for (viewer = man_viewer_list; viewer; viewer = viewer->next) |
367 | { | ||
368 | exec_viewer(viewer->name, page); /* will return when unable */ | 366 | exec_viewer(viewer->name, page); /* will return when unable */ |
369 | } | 367 | |
370 | if (fallback) | 368 | if (fallback) |
371 | exec_viewer(fallback, page); | 369 | exec_viewer(fallback, page); |
372 | exec_viewer("man", page); | 370 | exec_viewer("man", page); |