Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 339024
b: refs/heads/master
c: 0020ce2
h: refs/heads/master
v: v3
  • Loading branch information
Namhyung Kim authored and Arnaldo Carvalho de Melo committed Nov 14, 2012
1 parent fe72095 commit bce02ba
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 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: 4f746c95f18ad4d85599d9c157da7e6da766c3d9
refs/heads/master: 0020ce23864d16f66e5667013b8b43d1df3e142e
15 changes: 10 additions & 5 deletions trunk/tools/perf/perf.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,21 +85,26 @@ int check_pager_config(const char *cmd)
return c.val;
}

static int tui_command_config(const char *var, const char *value, void *data)
static int browser_command_config(const char *var, const char *value, void *data)
{
struct pager_config *c = data;
if (!prefixcmp(var, "tui.") && !strcmp(var + 4, c->cmd))
c->val = perf_config_bool(var, value);
if (!prefixcmp(var, "gtk.") && !strcmp(var + 4, c->cmd))
c->val = perf_config_bool(var, value) ? 2 : 0;
return 0;
}

/* returns 0 for "no tui", 1 for "use tui", and -1 for "not specified" */
static int check_tui_config(const char *cmd)
/*
* returns 0 for "no tui", 1 for "use tui", 2 for "use gtk",
* and -1 for "not specified"
*/
static int check_browser_config(const char *cmd)
{
struct pager_config c;
c.cmd = cmd;
c.val = -1;
perf_config(tui_command_config, &c);
perf_config(browser_command_config, &c);
return c.val;
}

Expand Down Expand Up @@ -302,7 +307,7 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
prefix = NULL; /* setup_perf_directory(); */

if (use_browser == -1)
use_browser = check_tui_config(p->cmd);
use_browser = check_browser_config(p->cmd);

if (use_pager == -1 && p->option & RUN_SETUP)
use_pager = check_pager_config(p->cmd);
Expand Down

0 comments on commit bce02ba

Please sign in to comment.