mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 759626 - Cache the result of InferSpewColorable to avoid a ton of getenv calls. r=bhackett
--HG-- extra : rebase_source : bcf1055b9f401561c1bbc33a4757177df1b81d60
This commit is contained in:
parent
3b11140cbd
commit
ee3c9c779a
@ -138,10 +138,17 @@ static bool InferSpewActive(SpewChannel channel)
|
||||
static bool InferSpewColorable()
|
||||
{
|
||||
/* Only spew colors on xterm-color to not screw up emacs. */
|
||||
const char *env = getenv("TERM");
|
||||
if (!env)
|
||||
return false;
|
||||
return strcmp(env, "xterm-color") == 0;
|
||||
static bool colorable = false;
|
||||
static bool checked = false;
|
||||
if (!checked) {
|
||||
checked = true;
|
||||
const char *env = getenv("TERM");
|
||||
if (!env)
|
||||
return false;
|
||||
if (strcmp(env, "xterm-color") == 0 || strcmp(env, "xterm-256color") == 0)
|
||||
colorable = true;
|
||||
}
|
||||
return colorable;
|
||||
}
|
||||
|
||||
const char *
|
||||
|
Loading…
Reference in New Issue
Block a user