config: compilation fixes

This commit is contained in:
Carlos Martín Nieto 2013-08-08 11:55:47 +02:00
parent 4d588d9713
commit 82ae6fcdba
2 changed files with 11 additions and 12 deletions

View File

@ -24,10 +24,10 @@ struct git_config {
git_vector files; git_vector files;
}; };
typedef struct { struct git_config_backend_iter {
git_config_backend *backend; git_config_backend *backend;
unsigned int flags; unsigned int flags;
} git_config_backend_iter; };
extern int git_config_find_global_r(git_buf *global_config_path); extern int git_config_find_global_r(git_buf *global_config_path);
extern int git_config_find_xdg_r(git_buf *system_config_path); extern int git_config_find_xdg_r(git_buf *system_config_path);

View File

@ -28,8 +28,7 @@ typedef struct cvar_t {
} cvar_t; } cvar_t;
typedef struct git_config_file_iter { typedef struct git_config_file_iter {
git_config_backend *backend; git_config_backend_iter parent;
unsigned int flags;
git_strmap_iter iter; git_strmap_iter iter;
cvar_t* next; cvar_t* next;
} git_config_file_iter; } git_config_file_iter;
@ -260,17 +259,17 @@ static int config_iterator_new(
struct git_config_backend* backend) struct git_config_backend* backend)
{ {
diskfile_backend *b = (diskfile_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) if (!b->values || git_strmap_num_entries(b->values) < 1)
return -1; return -1;
*it = git__calloc(1, sizeof(git_config_file_iter));
GITERR_CHECK_ALLOC(it); GITERR_CHECK_ALLOC(it);
(*it)->backend = backend; it->parent.backend = backend;
(*it)->iter = git_strmap_begin(b->values); it->iter = git_strmap_begin(b->values);
(*it)->next = NULL; it->next = NULL;
*iter = (git_config_backend_iter *) it;
return 0; return 0;
} }
@ -285,9 +284,9 @@ static int config_iterator_next(
git_config_entry *entry, git_config_entry *entry,
git_config_backend_iter *iter) git_config_backend_iter *iter)
{ {
git_config_file_iter *it = *((git_config_file_iter**) iter); git_config_file_iter *it = (git_config_file_iter *) iter;
diskfile_backend *b = (diskfile_backend *)it->backend; diskfile_backend *b = (diskfile_backend *) it->parent.backend;
int err; int err = 0;
cvar_t * var; cvar_t * var;
const char* key; const char* key;