Esempio n. 1
0
int want_color(int var)
{
    static int want_auto = -1;

    if (var < 0)
        var = git_use_color_default;

    if (var == GIT_COLOR_AUTO) {
        if (want_auto < 0)
            want_auto = check_auto_color();
        return want_auto;
    }
    return var;
}
Esempio n. 2
0
int want_color(int var)
{
	/*
	 * NEEDSWORK: This function is sometimes used from multiple threads, and
	 * we end up using want_auto racily. That "should not matter" since
	 * we always write the same value, but it's still wrong. This function
	 * is listed in .tsan-suppressions for the time being.
	 */

	static int want_auto = -1;

	if (var < 0)
		var = git_use_color_default;

	if (var == GIT_COLOR_AUTO) {
		if (want_auto < 0)
			want_auto = check_auto_color();
		return want_auto;
	}
	return var;
}