MCPcopy Create free account
hub / github.com/git/git / tr2_sysenv_get

Function tr2_sysenv_get

trace2/tr2_sysenv.c:103–118  ·  view source on GitHub ↗

* Return the value for the requested Trace2 setting from these sources: * the system config, the global config, and the environment. */

Source from the content-addressed store, hash-verified

101 * the system config, the global config, and the environment.
102 */
103const char *tr2_sysenv_get(enum tr2_sysenv_variable var)
104{
105 if (var >= TR2_SYSENV_MUST_BE_LAST)
106 BUG("tr2_sysenv_get invalid var '%d'", var);
107
108 if (!tr2_sysenv_settings[var].getenv_called) {
109 const char *v = getenv(tr2_sysenv_settings[var].env_var_name);
110 if (v && *v) {
111 free(tr2_sysenv_settings[var].value);
112 tr2_sysenv_settings[var].value = xstrdup(v);
113 }
114 tr2_sysenv_settings[var].getenv_called = 1;
115 }
116
117 return tr2_sysenv_settings[var].value;
118}
119
120/*
121 * Return a friendly name for this setting that is suitable for printing

Callers 8

fn_initFunction · 0.85
tr2_dst_want_warningFunction · 0.85
tr2_dst_too_many_filesFunction · 0.85
tr2_dst_get_trace_fdFunction · 0.85
fn_initFunction · 0.85
fn_initFunction · 0.85
tr2_cfg_load_patternsFunction · 0.85
tr2_load_env_varsFunction · 0.85

Calls 1

xstrdupFunction · 0.85

Tested by

no test coverage detected