Re: git config problem with strange config files

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jan 01, 2008 at 01:17:34AM -0500, Jeff King wrote:

> @@ -118,7 +119,7 @@ static int get_value(config_fn_t fn, char *name, unsigned int len)
>  	/* Get the full name */
>  	for (;;) {
>  		c = get_next_char();
> -		if (c == EOF)
> +		if (config_file_eof)
>  			break;
>  		if (!iskeychar(c))
>  			break;
> @@ -182,7 +183,7 @@ static int get_base_var(char *name)
>  
>  	for (;;) {
>  		int c = get_next_char();
> -		if (c == EOF)
> +		if (config_file_eof)
>  			return -1;
>  		if (c == ']')
>  			return baselen;

In these two hunks, we now check the eof flag correctly, which follows
through on the intent of the original code. But if you look carefully at
get_next_char(), it _never_ returns EOF in the first place; it replaces
it with '\n' and sets an external flag. So this 'if' branch was never
reached, but happened to work because the returned newline triggers a
similar effect.

By actually looking at the flag, I am implementing the original intent,
but it is a potential behavior change (I don't _think_ it should matter,
and it passes all of the config tests, but I haven't looked carefully at
all the ramifications). So it might be simpler yet to just eliminate
that conditional return.

-Peff
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux