[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1274111278-2838-4-git-send-email-acme@infradead.org>
Date: Mon, 17 May 2010 12:47:58 -0300
From: Arnaldo Carvalho de Melo <acme@...radead.org>
To: Ingo Molnar <mingo@...e.hu>
Cc: linux-kernel@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>,
Frédéric Weisbecker <fweisbec@...il.com>,
Lin Ming <ming.m.lin@...el.com>,
Mike Galbraith <efault@....de>,
Paul Mackerras <paulus@...ba.org>,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Tom Zanussi <tzanussi@...il.com>
Subject: [PATCH 3/3] perf tui: Add workaround for slang < 2.1.4
From: Arnaldo Carvalho de Melo <acme@...hat.com>
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@...el.com>
Cc: Frédéric Weisbecker <fweisbec@...il.com>
Cc: Lin Ming <ming.m.lin@...el.com>
Cc: Mike Galbraith <efault@....de>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc: Tom Zanussi <tzanussi@...il.com>
LKML-Reference: <20100517145421.GD29052@...stprotocols.net>
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
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 2001d26..ccb7c5b 100644
--- a/tools/perf/util/newt.c
+++ b/tools/perf/util/newt.c
@@ -14,6 +14,17 @@
#include "sort.h"
#include "symbol.h"
+#if SLANG_VERSION < 20104
+#define slsmg_printf(msg, args...) SLsmg_printf((char *)msg, ##args)
+#define slsmg_write_nstring(msg, len) SLsmg_write_nstring((char *)msg, len)
+#define sltt_set_color(obj, name, fg, bg) SLtt_set_color(obj,(char *)name,\
+ (char *)fg, (char *)bg)
+#else
+#define slsmg_printf SLsmg_printf
+#define slsmg_write_nstring SLsmg_write_nstring
+#define sltt_set_color SLtt_set_color
+#endif
+
struct ui_progress {
newtComponent form, scale;
};
@@ -292,21 +303,21 @@ static int objdump_line__show(struct objdump_line *self, struct list_head *head,
color = ui_browser__percent_color(percent, current_entry);
SLsmg_set_color(color);
- SLsmg_printf(" %7.2f ", percent);
+ slsmg_printf(" %7.2f ", percent);
if (!current_entry)
SLsmg_set_color(HE_COLORSET_CODE);
} else {
int color = ui_browser__percent_color(0, current_entry);
SLsmg_set_color(color);
- SLsmg_write_nstring(" ", 9);
+ slsmg_write_nstring(" ", 9);
}
SLsmg_write_char(':');
- SLsmg_write_nstring(" ", 8);
+ slsmg_write_nstring(" ", 8);
if (!*self->line)
- SLsmg_write_nstring(" ", width - 18);
+ slsmg_write_nstring(" ", width - 18);
else
- SLsmg_write_nstring(self->line, width - 18);
+ slsmg_write_nstring(self->line, width - 18);
return 0;
}
@@ -1054,11 +1065,11 @@ void setup_browser(void)
newtInit();
newtCls();
ui_helpline__puts(" ");
- SLtt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg);
- SLtt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg);
- SLtt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg);
- SLtt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg);
- SLtt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg);
+ sltt_set_color(HE_COLORSET_TOP, NULL, c->topColorFg, c->topColorBg);
+ sltt_set_color(HE_COLORSET_MEDIUM, NULL, c->mediumColorFg, c->mediumColorBg);
+ sltt_set_color(HE_COLORSET_NORMAL, NULL, c->normalColorFg, c->normalColorBg);
+ sltt_set_color(HE_COLORSET_SELECTED, NULL, c->selColorFg, c->selColorBg);
+ sltt_set_color(HE_COLORSET_CODE, NULL, c->codeColorFg, c->codeColorBg);
}
void exit_browser(bool wait_for_ok)
--
1.6.2.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists