Since most things will not be using XDG_*, reduce the number of strcmp's by

first checking that we are NOT using XDG_*. Should provide a speedup for
evaluating.


SVN revision: 32034
This commit is contained in:
Christopher Michael 2007-10-10 10:53:09 +00:00
parent c999ac8a20
commit bf4118f350
1 changed files with 11 additions and 7 deletions

View File

@ -660,14 +660,18 @@ e_util_shell_env_path_eval(char *path)
s = alloca(v2 - v1);
strncpy(s, v1 + 1, v2 - v1 - 1);
s[v2 - v1 - 1] = 0;
if (!strcmp(s, "XDG_CONFIG_HOME"))
v = (char *)efreet_config_home_get();
else if (!strcmp(s, "XDG_CACHE_HOME"))
v = (char *)efreet_cache_home_get();
else if (!strcmp(s, "XDG_DATA_HOME"))
v = (char *)efreet_data_home_get();
else
if (strncmp(s, "XDG", 3))
v = getenv(s);
else
{
if (!strcmp(s, "XDG_CONFIG_HOME"))
v = (char *)efreet_config_home_get();
else if (!strcmp(s, "XDG_CACHE_HOME"))
v = (char *)efreet_cache_home_get();
else if (!strcmp(s, "XDG_DATA_HOME"))
v = (char *)efreet_data_home_get();
}
if (v)
{
vp = v;