Skip to contentSkip to conversation

13120:3e2d3d737624 breaks Solaris compile

PATCH New John Levon 1 participant 2 messages Dec 22, 2006 – Dec 28, 2006

lore
Share & tools
lore

John Levon

author
#0 lore raw

The changes to xentop.c:

- vwprintw(stdscr, (char *)fmt, args);
+ vwprintw(stdscr, (const char *)fmt, args);
- addstr((char *)str);
+ addstr((const char *)str);

Are both unneccessary on Linux (as they're const char * already), and broken on Solaris, where we have rather unfortunate prototypes from pre-history that aren't constified. I think these need to be reverted back to being the meaningful '(char *)'.

regards,
john

author
#1 lore raw

PATCH 1/1 13120:3e2d3d737624 breaks Solaris compile

Quoted 4 lines · John Levon

Are both unneccessary on Linux (as they're const char * already), and broken on Solaris, where we have rather unfortunate prototypes from pre-history that aren't constified. I think these need to be reverted back to being the meaningful '(char *)'.

The below is still needed.

regards
john

# HG changeset patch
# User [email protected]
# Date 1167321418 28800
# Node ID a00bf3c8f7bc8cb8537b153c61e6d09c9b494459
# Parent bce4fd687b7901de6f2e72ea37d92508eb3f5a77
Older curses implementations don't have const-safe prototypes, so we must cast.

tools/xenstat/xentop/xentop.c +2 -2
@@ -271,7 +271,7 @@ static void print(const char *fmt, ...)
 	if (!batch) {
 		if((current_row() < lines()-1)) {
 			va_start(args, fmt);
-			vwprintw(stdscr, fmt, args);
+			vwprintw(stdscr, (char *)fmt, args);
 			va_end(args);
 		}
 	} else {
@@ -285,7 +285,7 @@ static void attr_addstr(int attr, const 
 static void attr_addstr(int attr, const char *str)
 {
 	attron(attr);
-	addstr(str);
+	addstr((char *)str);
 	attroff(attr);
 }