Commit d49b1365be316b6aa7c6c4c6535ff810853d0c46

Patrick Steinhardt 2018-08-10T19:01:37

config_entries: internalize structure declarations Access to the config entries is now completely done via the modules function interface and no caller messes with the struct's internals. We can thus completely move the structure declarations into the implementation file so that nobody even has a chance to mess with the members.

diff --git a/src/config_entries.c b/src/config_entries.c
index 5782fab..2e02c31 100644
--- a/src/config_entries.c
+++ b/src/config_entries.c
@@ -7,11 +7,23 @@
 
 #include "config_entries.h"
 
+typedef struct config_entry_list {
+	struct config_entry_list *next;
+	struct config_entry_list *last;
+	git_config_entry *entry;
+} config_entry_list;
+
 typedef struct config_entries_iterator {
 	git_config_iterator parent;
 	config_entry_list *head;
 } config_entries_iterator;
 
+struct git_config_entries {
+	git_refcount rc;
+	git_strmap *map;
+	config_entry_list *list;
+};
+
 static void config_entry_list_free(config_entry_list *list)
 {
 	config_entry_list *next;
diff --git a/src/config_entries.h b/src/config_entries.h
index 5ee5d4e..02292e2 100644
--- a/src/config_entries.h
+++ b/src/config_entries.h
@@ -10,17 +10,7 @@
 #include "git2/sys/config.h"
 #include "config.h"
 
-typedef struct config_entry_list {
-	struct config_entry_list *next;
-	struct config_entry_list *last;
-	git_config_entry *entry;
-} config_entry_list;
-
-typedef struct {
-	git_refcount rc;
-	git_strmap *map;
-	config_entry_list *list;
-} git_config_entries;
+typedef struct git_config_entries git_config_entries;
 
 int git_config_entries_new(git_config_entries **out);
 void git_config_entries_incref(git_config_entries *entries);