From 934fcf78f2877008979a6729fab5e81de2fd1d65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Wed, 30 Mar 2011 11:32:08 +0200 Subject: [PATCH] Initialise the config reader in config_parse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git_config_open shouldn't have to initialise variables that are only used inside config_parse and its callees. Signed-off-by: Carlos Martín Nieto --- src/config.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index a49191148..da0390dc5 100644 --- a/src/config.c +++ b/src/config.c @@ -86,9 +86,6 @@ int git_config_open(git_config **cfg_out, const char *path) if(error < GIT_SUCCESS) goto cleanup; - /* Initialise the reading position */ - cfg->reader.read_ptr = cfg->reader.buffer.data; - error = config_parse(cfg); if(error < GIT_SUCCESS) git_config_free(cfg); @@ -599,6 +596,10 @@ static int config_parse(git_config *cfg_file) int error = GIT_SUCCESS; char *current_section = NULL; + /* Initialise the reading position */ + cfg_file->reader.read_ptr = cfg_file->reader.buffer.data; + cfg_file->reader.eof = 0; + skip_bom(cfg_file); while (error == GIT_SUCCESS && !cfg_file->reader.eof) {