diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-17 11:25:09 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-17 11:28:34 -0400 |
commit | dc4ff19341126155c5714119396efbae62ab40bf (patch) | |
tree | b0d73a3146a79341bbbdebbb1139b84067306315 /tools | |
parent | 3de29cab1f8d62db557a4afed0fb17eebfe64438 (diff) |
perf tui: Add workaround for slang < 2.1.4
Older versions of the slang library didn't used the 'const' specifier,
causing problems with modern compilers of this kind:
util/newt.c:252: error: passing argument 1 of ‘SLsmg_printf’ discards
qualifiers from pointer target type
Fix it by using some wrappers that when needed const the affected
parameters back to plain (char *).
Reported-by: Lin Ming <ming.m.lin@intel.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Lin Ming <ming.m.lin@intel.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Tom Zanussi <tzanussi@gmail.com>
LKML-Reference: <20100517145421.GD29052@ghostprotocols.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/newt.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index 2001d26a5579..ccb7c5bb269e 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c | |||
@@ -14,6 +14,17 @@ | |||
14 | #include "sort.h" | 14 | #include "sort.h" |
15 | #include "symbol.h" | 15 | #include "symbol.h" |
16 | 16 | ||
17 | #if SLANG_VERSION < 20104 | ||
18 | #define slsmg_printf(msg, args...) SLsmg_printf((char *)msg, ##args) | ||
19 | #define slsmg_write_nstring(msg, len) SLsmg_write_nstring((char *)msg, len) | ||
20 | #define sltt_set_color(obj, name, fg, bg) SLtt_set_color(obj,(char *)name,\ | ||
21 | (char *)fg, (char *)bg) | ||
22 | #else | ||
23 | #define slsmg_printf SLsmg_printf | ||
24 | #define slsmg_write_nstring SLsmg_write_nstring | ||
25 | #define sltt_set_color SLtt_set_color | ||
26 | #endif | ||
27 | |||
17 | struct ui_progress { | 28 | struct ui_progress { |
18 | newtComponent form, scale; | 29 | newtComponent form, scale; |
19 | }; | 30 | }; |
@@ -292,21 +303,21 @@ static int objdump_line__show(struct objdump_line *self, struct list_head *head, | |||
292 | 303 | ||
293 | color = ui_browser__percent_color(percent, current_entry); | 304 | color = ui_browser__percent_color(percent, current_entry); |
294 | SLsmg_set_color(color); | 305 | SLsmg_set_color(color); |
295 | SLsmg_printf(" %7.2f ", percent); | 306 | slsmg_printf(" %7.2f ", percent); |
296 | if (!current_entry) | 307 | if (!current_entry) |
297 | SLsmg_set_color(HE_COLORSET_CODE); | 308 | SLsmg_set_color(HE_COLORSET_CODE); |
298 | } else { | 309 | } else { |
299 | int color = ui_browser__percent_color(0, current_entry); | 310 | int color = ui_browser__percent_color(0, current_entry); |
300 | SLsmg_set_color(color); | 311 | SLsmg_set_color(color); |
301 | SLsmg_write_nstring(" ", 9); | 312 | slsmg_write_nstring(" ", 9); |
302 | } | 313 | } |
303 | 314 | ||
304 | SLsmg_write_char(':'); | 315 | SLsmg_write_char(':'); |
305 | SLsmg_write_nstring(" ", 8); | 316 | slsmg_write_nstring(" ", 8); |
306 | if (!*self->line) | 317 | if (!*self->line) |
307 | SLsmg_write_nstring(" ", width - 18); | 318 | slsmg_write_nstring(" ", width - 18); |
308 | else | 319 | else |
309 | SLsmg_write_nstring(self->line, width - 18); | 320 | slsmg_write_nstring(self->line, width - 18); |
310 | 321 | ||
311 | return 0; | 322 | return 0; |
312 | } | 323 | } |
@@ -1054,11 +1065,11 @@ void setup_browser(void) | |||
1054 | newtInit(); | 1065 | newtInit(); |
1055 | newtCls(); | 1066 | newtCls(); |
1056 | ui_helpline__puts(" "); | 1067 | ui_helpline__puts(" "); |
1057 | SLtt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg); | 1068 | sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg); |
1058 | SLtt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg); | 1069 | sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg); |
1059 | SLtt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg); | 1070 | sltt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg); |
1060 | SLtt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg); | 1071 | sltt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg); |
1061 | SLtt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg); | 1072 | sltt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg); |
1062 | } | 1073 | } |
1063 | 1074 | ||
1064 | void exit_browser(bool wait_for_ok) | 1075 | void exit_browser(bool wait_for_ok) |