git-2.22.0/trace2/tr2_sysenv.c
/*
 * Return the value for the requested Trace2 setting from these sources:
 * the system config, the global config, and the environment.
 */
Return the value for the requested Trace2 setting from these sources:
the system config, the global config, and the environment.
Return the value for the requested Trace2 setting from these sources : the system config the global config and the environment .
const char *tr2_sysenv_get(enum tr2_sysenv_variable var)
{
	if (var >= TR2_SYSENV_MUST_BE_LAST)
		BUG("tr2_sysenv_get invalid var '%d'", var);
	if (!tr2_sysenv_settings[var].getenv_called) {
		const char *v = getenv(tr2_sysenv_settings[var].env_var_name);
		if (v && *v) {
			free(tr2_sysenv_settings[var].value);
			tr2_sysenv_settings[var].value = xstrdup(v);
		}
		tr2_sysenv_settings[var].getenv_called = 1;
	}
	return tr2_sysenv_settings[var].value;
}
const char * tr2_sysenv_get ( enum tr2_sysenv_variable var ) { if ( var >= TR2_SYSENV_MUST_BE_LAST ) BUG ( " " , var ) ; if ( ! tr2_sysenv_settings [ var ] . getenv_called ) { const char * v = getenv ( tr2_sysenv_settings [ var ] . env_var_name ) ; if ( v && * v ) { free ( tr2_sysenv_settings [ var ] . value ) ; tr2_sysenv_settings [ var ] . value = xstrdup ( v ) ; } tr2_sysenv_settings [ var ] . getenv_called = 1 ; } return tr2_sysenv_settings [ var ] . value ; }
Return the value for the requested Trace2 setting from these sources:
 the system config, the global config, and the environment.
Return the value for the requested Trace2 setting from these sources : the system config the global config and the environment .