git-2.22.0/trace2/tr2_cfg.c
/*
 * Parse a string containing a comma-delimited list of config keys
 * or wildcard patterns into a list of strbufs.
 */
Parse a string containing a comma-delimited list of config keys
or wildcard patterns into a list of strbufs.
Parse a string containing a comma - delimited list of config keys or wildcard patterns into a list of strbufs .
static int tr2_cfg_load_patterns(void)
{
	struct strbuf **s;
	const char *envvar;
	if (tr2_cfg_loaded)
		return tr2_cfg_count_patterns;
	tr2_cfg_loaded = 1;
	envvar = tr2_sysenv_get(TR2_SYSENV_CFG_PARAM);
	if (!envvar || !*envvar)
		return tr2_cfg_count_patterns;
	tr2_cfg_patterns = strbuf_split_buf(envvar, strlen(envvar), ',', -1);
	for (s = tr2_cfg_patterns; *s; s++) {
		struct strbuf *buf = *s;
		if (buf->len && buf->buf[buf->len - 1] == ',')
			strbuf_setlen(buf, buf->len - 1);
		strbuf_trim_trailing_newline(*s);
		strbuf_trim(*s);
	}
	tr2_cfg_count_patterns = s - tr2_cfg_patterns;
	return tr2_cfg_count_patterns;
}
static int tr2_cfg_load_patterns ( void ) { struct strbuf * * s ; const char * envvar ; if ( tr2_cfg_loaded ) return tr2_cfg_count_patterns ; tr2_cfg_loaded = 1 ; envvar = tr2_sysenv_get ( TR2_SYSENV_CFG_PARAM ) ; if ( ! envvar || ! * envvar ) return tr2_cfg_count_patterns ; tr2_cfg_patterns = strbuf_split_buf ( envvar , strlen ( envvar ) , ' ' , -1 ) ; for ( s = tr2_cfg_patterns ; * s ; s ++ ) { struct strbuf * buf = * s ; if ( buf -> len && buf -> buf [ buf -> len - 1 ] == ' ' ) strbuf_setlen ( buf , buf -> len - 1 ) ; strbuf_trim_trailing_newline ( * s ) ; strbuf_trim ( * s ) ; } tr2_cfg_count_patterns = s - tr2_cfg_patterns ; return tr2_cfg_count_patterns ; }
Parse a string containing a comma-delimited list of config keys
 or wildcard patterns into a list of strbufs.
Parse a string containing a comma - delimited list of config keys or wildcard patterns into a list of strbufs .