Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349877
b: refs/heads/master
c: b56e533
h: refs/heads/master
i:
  349875: 72c381f
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Dec 9, 2012
1 parent 1ec8595 commit 4a0db5f
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 50 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 752914208ada0d9ae0a6b3bf2906d43f3605832f
refs/heads/master: b56e53312d445967f6bdb91e5667c56755e47450
23 changes: 12 additions & 11 deletions trunk/tools/perf/ui/gtk/helpline.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ static void gtk_helpline_push(const char *msg)
pgctx->statbar_ctx_id, msg);
}

static struct ui_helpline gtk_helpline_fns = {
.pop = gtk_helpline_pop,
.push = gtk_helpline_push,
};

void perf_gtk__init_helpline(void)
{
helpline_fns = &gtk_helpline_fns;
}

int perf_gtk__show_helpline(const char *fmt, va_list ap)
static int gtk_helpline_show(const char *fmt, va_list ap)
{
int ret;
char *ptr;
Expand All @@ -54,3 +44,14 @@ int perf_gtk__show_helpline(const char *fmt, va_list ap)

return ret;
}

static struct ui_helpline gtk_helpline_fns = {
.pop = gtk_helpline_pop,
.push = gtk_helpline_push,
.show = gtk_helpline_show,
};

void perf_gtk__init_helpline(void)
{
helpline_fns = &gtk_helpline_fns;
}
12 changes: 12 additions & 0 deletions trunk/tools/perf/ui/helpline.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ static void nop_helpline__push(const char *msg __maybe_unused)
{
}

static int nop_helpline__show(const char *fmt __maybe_unused,
va_list ap __maybe_unused)
{
return 0;
}

static struct ui_helpline default_helpline_fns = {
.pop = nop_helpline__pop,
.push = nop_helpline__push,
.show = nop_helpline__show,
};

struct ui_helpline *helpline_fns = &default_helpline_fns;
Expand Down Expand Up @@ -59,3 +66,8 @@ void ui_helpline__puts(const char *msg)
ui_helpline__pop();
ui_helpline__push(msg);
}

int ui_helpline__vshow(const char *fmt, va_list ap)
{
return helpline_fns->show(fmt, ap);
}
22 changes: 2 additions & 20 deletions trunk/tools/perf/ui/helpline.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
struct ui_helpline {
void (*pop)(void);
void (*push)(const char *msg);
int (*show)(const char *fmt, va_list ap);
};

extern struct ui_helpline *helpline_fns;
Expand All @@ -20,28 +21,9 @@ void ui_helpline__push(const char *msg);
void ui_helpline__vpush(const char *fmt, va_list ap);
void ui_helpline__fpush(const char *fmt, ...);
void ui_helpline__puts(const char *msg);
int ui_helpline__vshow(const char *fmt, va_list ap);

extern char ui_helpline__current[512];

#ifdef NEWT_SUPPORT
extern char ui_helpline__last_msg[];
int ui_helpline__show_help(const char *format, va_list ap);
#else
static inline int ui_helpline__show_help(const char *format __maybe_unused,
va_list ap __maybe_unused)
{
return 0;
}
#endif /* NEWT_SUPPORT */

#ifdef GTK2_SUPPORT
int perf_gtk__show_helpline(const char *format, va_list ap);
#else
static inline int perf_gtk__show_helpline(const char *format __maybe_unused,
va_list ap __maybe_unused)
{
return 0;
}
#endif /* GTK2_SUPPORT */

#endif /* _PERF_UI_HELPLINE_H_ */
29 changes: 15 additions & 14 deletions trunk/tools/perf/ui/tui/helpline.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#include "../ui.h"
#include "../libslang.h"

char ui_helpline__last_msg[1024];

static void tui_helpline__pop(void)
{
}
Expand All @@ -23,20 +25,7 @@ static void tui_helpline__push(const char *msg)
strncpy(ui_helpline__current, msg, sz)[sz - 1] = '\0';
}

struct ui_helpline tui_helpline_fns = {
.pop = tui_helpline__pop,
.push = tui_helpline__push,
};

void ui_helpline__init(void)
{
helpline_fns = &tui_helpline_fns;
ui_helpline__puts(" ");
}

char ui_helpline__last_msg[1024];

int ui_helpline__show_help(const char *format, va_list ap)
static int tui_helpline__show(const char *format, va_list ap)
{
int ret;
static int backlog;
Expand All @@ -55,3 +44,15 @@ int ui_helpline__show_help(const char *format, va_list ap)

return ret;
}

struct ui_helpline tui_helpline_fns = {
.pop = tui_helpline__pop,
.push = tui_helpline__push,
.show = tui_helpline__show,
};

void ui_helpline__init(void)
{
helpline_fns = &tui_helpline_fns;
ui_helpline__puts(" ");
}
6 changes: 2 additions & 4 deletions trunk/tools/perf/util/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ int eprintf(int level, const char *fmt, ...)

if (verbose >= level) {
va_start(args, fmt);
if (use_browser == 1)
ret = ui_helpline__show_help(fmt, args);
else if (use_browser == 2)
ret = perf_gtk__show_helpline(fmt, args);
if (use_browser > 1)
ui_helpline__vshow(fmt, args);
else
ret = vfprintf(stderr, fmt, args);
va_end(args);
Expand Down

0 comments on commit 4a0db5f

Please sign in to comment.