config: compilation fixes
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
diff --git a/src/config.h b/src/config.h
index ea150e9..2f7c96d 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 ea571e9..849ef0f 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;