config: drop cf validity check in get_next_char()

The global variable cf is set with an initialized value in all codepaths before
calling this function.

The complete call graph looks like this:

  git_config_from_file
    -> do_config_from
      -> git_parse_file
        -> get_next_char
        -> get_value
            -> get_next_char
            -> parse_value
                -> get_next_char
        -> get_base_var
            -> get_next_char
            -> get_extended_base_var
                -> get_next_char

The variable is initialized in do_config_from.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Heiko Voigt 2013-05-11 15:19:29 +02:00 коммит произвёл Junio C Hamano
Родитель ca4b5de28b
Коммит dbb9a81255
1 изменённых файлов: 13 добавлений и 16 удалений

Просмотреть файл

@ -169,10 +169,8 @@ int git_config_from_parameters(config_fn_t fn, void *data)
static int get_next_char(void)
{
int c;
FILE *f;
FILE *f = cf->f;
c = '\n';
if (cf && ((f = cf->f) != NULL)) {
c = fgetc(f);
if (c == '\r') {
/* DOS like systems */
@ -188,7 +186,6 @@ static int get_next_char(void)
cf->eof = 1;
c = '\n';
}
}
return c;
}