From 82ae6fcdba2aa0fb21f49b127b5f5f7a637ffc76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Thu, 8 Aug 2013 11:55:47 +0200 Subject: [PATCH] config: compilation fixes --- src/config.h | 4 ++-- src/config_file.c | 19 +++++++++---------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/config.h b/src/config.h index ea150e968..2f7c96d7f 100644 --- a/src/config.h +++ b/src/config.h @@ -24,10 +24,10 @@ struct git_config { git_vector files; }; -typedef struct { +struct git_config_backend_iter { git_config_backend *backend; unsigned int flags; -} git_config_backend_iter; +}; extern int git_config_find_global_r(git_buf *global_config_path); extern int git_config_find_xdg_r(git_buf *system_config_path); diff --git a/src/config_file.c b/src/config_file.c index ea571e9f8..849ef0f6f 100644 --- a/src/config_file.c +++ b/src/config_file.c @@ -28,8 +28,7 @@ typedef struct cvar_t { } cvar_t; typedef struct git_config_file_iter { - git_config_backend *backend; - unsigned int flags; + git_config_backend_iter parent; git_strmap_iter iter; cvar_t* next; } git_config_file_iter; @@ -260,17 +259,17 @@ static int config_iterator_new( struct git_config_backend* backend) { diskfile_backend *b = (diskfile_backend *)backend; - git_config_file_iter **it= ((git_config_file_iter**) iter); + git_config_file_iter *it = git__calloc(1, sizeof(git_config_file_iter)); if (!b->values || git_strmap_num_entries(b->values) < 1) return -1; - *it = git__calloc(1, sizeof(git_config_file_iter)); GITERR_CHECK_ALLOC(it); - (*it)->backend = backend; - (*it)->iter = git_strmap_begin(b->values); - (*it)->next = NULL; + it->parent.backend = backend; + it->iter = git_strmap_begin(b->values); + it->next = NULL; + *iter = (git_config_backend_iter *) it; return 0; } @@ -285,9 +284,9 @@ static int config_iterator_next( git_config_entry *entry, git_config_backend_iter *iter) { - git_config_file_iter *it = *((git_config_file_iter**) iter); - diskfile_backend *b = (diskfile_backend *)it->backend; - int err; + git_config_file_iter *it = (git_config_file_iter *) iter; + diskfile_backend *b = (diskfile_backend *) it->parent.backend; + int err = 0; cvar_t * var; const char* key;