summaryrefslogtreecommitdiff
path: root/src/config.h
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@elego.de>2011-03-30 15:05:15 +0200
committerCarlos Martín Nieto <cmn@elego.de>2011-03-30 15:44:23 +0200
commitdadc0158fb9fd06f564ce92495dfe3ad9c4a9de8 (patch)
treea616fedb3dd0f5de7b5ad1893f97f4e20dff163b /src/config.h
parentd28830c2555820925d2d5ecf10d07436385d37d8 (diff)
downloadlibgit2-dadc0158fb9fd06f564ce92495dfe3ad9c4a9de8.tar.gz
config: use a singly-linked list instead of a hash table
Such a list preserves the order the variables were first read in which will be useful later for merging different data-sets. Furthermore, reading and writing out the same configuration should not reorganize the variables, which could happen when iterating through all the items in a hash table. A hash table is overkill for this small a data-set anyway. Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Diffstat (limited to 'src/config.h')
-rw-r--r--src/config.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/config.h b/src/config.h
index 2be013a72..5c16a1bc3 100644
--- a/src/config.h
+++ b/src/config.h
@@ -13,12 +13,21 @@ struct git_config {
int eof;
} reader;
- git_hashtable *vars;
+ git_cvar *vars;
+ git_cvar *vars_tail;
};
struct git_cvar {
+ git_cvar *next;
char *name;
char *value;
};
+/*
+ * If you're going to delete something inside this loop, it's such a
+ * hassle that you should use the for-loop directly.
+ */
+#define CVAR_LIST_FOREACH(start, iter) \
+ for ((iter) = (start); (iter) != NULL; (iter) = (iter)->next)
+
#endif