diff options
Diffstat (limited to 'tools/perf/util/help.c')
-rw-r--r-- | tools/perf/util/help.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/tools/perf/util/help.c b/tools/perf/util/help.c index 17a00e0df2c4..fbb00978b2e2 100644 --- a/tools/perf/util/help.c +++ b/tools/perf/util/help.c | |||
@@ -26,7 +26,7 @@ static int term_columns(void) | |||
26 | return 80; | 26 | return 80; |
27 | } | 27 | } |
28 | 28 | ||
29 | void add_cmdname(struct cmdnames *cmds, const char *name, int len) | 29 | void add_cmdname(struct cmdnames *cmds, const char *name, size_t len) |
30 | { | 30 | { |
31 | struct cmdname *ent = malloc(sizeof(*ent) + len + 1); | 31 | struct cmdname *ent = malloc(sizeof(*ent) + len + 1); |
32 | 32 | ||
@@ -40,7 +40,8 @@ void add_cmdname(struct cmdnames *cmds, const char *name, int len) | |||
40 | 40 | ||
41 | static void clean_cmdnames(struct cmdnames *cmds) | 41 | static void clean_cmdnames(struct cmdnames *cmds) |
42 | { | 42 | { |
43 | int i; | 43 | unsigned int i; |
44 | |||
44 | for (i = 0; i < cmds->cnt; ++i) | 45 | for (i = 0; i < cmds->cnt; ++i) |
45 | free(cmds->names[i]); | 46 | free(cmds->names[i]); |
46 | free(cmds->names); | 47 | free(cmds->names); |
@@ -57,7 +58,7 @@ static int cmdname_compare(const void *a_, const void *b_) | |||
57 | 58 | ||
58 | static void uniq(struct cmdnames *cmds) | 59 | static void uniq(struct cmdnames *cmds) |
59 | { | 60 | { |
60 | int i, j; | 61 | unsigned int i, j; |
61 | 62 | ||
62 | if (!cmds->cnt) | 63 | if (!cmds->cnt) |
63 | return; | 64 | return; |
@@ -71,7 +72,7 @@ static void uniq(struct cmdnames *cmds) | |||
71 | 72 | ||
72 | void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) | 73 | void exclude_cmds(struct cmdnames *cmds, struct cmdnames *excludes) |
73 | { | 74 | { |
74 | int ci, cj, ei; | 75 | size_t ci, cj, ei; |
75 | int cmp; | 76 | int cmp; |
76 | 77 | ||
77 | ci = cj = ei = 0; | 78 | ci = cj = ei = 0; |
@@ -106,8 +107,9 @@ static void pretty_print_string_list(struct cmdnames *cmds, int longest) | |||
106 | printf(" "); | 107 | printf(" "); |
107 | 108 | ||
108 | for (j = 0; j < cols; j++) { | 109 | for (j = 0; j < cols; j++) { |
109 | int n = j * rows + i; | 110 | unsigned int n = j * rows + i; |
110 | int size = space; | 111 | unsigned int size = space; |
112 | |||
111 | if (n >= cmds->cnt) | 113 | if (n >= cmds->cnt) |
112 | break; | 114 | break; |
113 | if (j == cols-1 || n + rows >= cmds->cnt) | 115 | if (j == cols-1 || n + rows >= cmds->cnt) |
@@ -208,7 +210,7 @@ void load_command_list(const char *prefix, | |||
208 | void list_commands(const char *title, struct cmdnames *main_cmds, | 210 | void list_commands(const char *title, struct cmdnames *main_cmds, |
209 | struct cmdnames *other_cmds) | 211 | struct cmdnames *other_cmds) |
210 | { | 212 | { |
211 | int i, longest = 0; | 213 | unsigned int i, longest = 0; |
212 | 214 | ||
213 | for (i = 0; i < main_cmds->cnt; i++) | 215 | for (i = 0; i < main_cmds->cnt; i++) |
214 | if (longest < main_cmds->names[i]->len) | 216 | if (longest < main_cmds->names[i]->len) |
@@ -239,7 +241,8 @@ void list_commands(const char *title, struct cmdnames *main_cmds, | |||
239 | 241 | ||
240 | int is_in_cmdlist(struct cmdnames *c, const char *s) | 242 | int is_in_cmdlist(struct cmdnames *c, const char *s) |
241 | { | 243 | { |
242 | int i; | 244 | unsigned int i; |
245 | |||
243 | for (i = 0; i < c->cnt; i++) | 246 | for (i = 0; i < c->cnt; i++) |
244 | if (!strcmp(s, c->names[i]->name)) | 247 | if (!strcmp(s, c->names[i]->name)) |
245 | return 1; | 248 | return 1; |
@@ -271,7 +274,8 @@ static int levenshtein_compare(const void *p1, const void *p2) | |||
271 | 274 | ||
272 | static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) | 275 | static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) |
273 | { | 276 | { |
274 | int i; | 277 | unsigned int i; |
278 | |||
275 | ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc); | 279 | ALLOC_GROW(cmds->names, cmds->cnt + old->cnt, cmds->alloc); |
276 | 280 | ||
277 | for (i = 0; i < old->cnt; i++) | 281 | for (i = 0; i < old->cnt; i++) |
@@ -283,7 +287,7 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old) | |||
283 | 287 | ||
284 | const char *help_unknown_cmd(const char *cmd) | 288 | const char *help_unknown_cmd(const char *cmd) |
285 | { | 289 | { |
286 | int i, n = 0, best_similarity = 0; | 290 | unsigned int i, n = 0, best_similarity = 0; |
287 | struct cmdnames main_cmds, other_cmds; | 291 | struct cmdnames main_cmds, other_cmds; |
288 | 292 | ||
289 | memset(&main_cmds, 0, sizeof(main_cmds)); | 293 | memset(&main_cmds, 0, sizeof(main_cmds)); |
@@ -345,7 +349,7 @@ const char *help_unknown_cmd(const char *cmd) | |||
345 | exit(1); | 349 | exit(1); |
346 | } | 350 | } |
347 | 351 | ||
348 | int cmd_version(int argc, const char **argv, const char *prefix) | 352 | int cmd_version(int argc __used, const char **argv __used, const char *prefix __used) |
349 | { | 353 | { |
350 | printf("perf version %s\n", perf_version_string); | 354 | printf("perf version %s\n", perf_version_string); |
351 | return 0; | 355 | return 0; |