config_file: rename cvar_t struct to config_entry_list The `cvar_t` structure is really awkward to grasp, because its name actively hinders discovery of what it actually is. As it is nothing more than a singly-linked list of configuration entries, name rename it to just that: `config_entry_list`.
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 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
diff --git a/src/config_file.c b/src/config_file.c
index d4e1c0a..4294f0b 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -23,15 +23,15 @@
#include <sys/types.h>
#include <regex.h>
-typedef struct cvar_t {
- struct cvar_t *next;
+typedef struct config_entry_list {
+ struct config_entry_list *next;
git_config_entry *entry;
-} cvar_t;
+} config_entry_list;
typedef struct git_config_file_iter {
git_config_iterator parent;
git_strmap_iter iter;
- cvar_t* next_var;
+ config_entry_list* next_var;
} git_config_file_iter;
/* Max depth for [include] directives */
@@ -82,7 +82,7 @@ static int config_error_readonly(void)
return -1;
}
-static void cvar_free(cvar_t *var)
+static void cvar_free(config_entry_list *var)
{
if (var == NULL)
return;
@@ -120,10 +120,10 @@ int git_config_file_normalize_section(char *start, char *end)
static int append_entry(git_strmap *values, git_config_entry *entry)
{
git_strmap_iter pos;
- cvar_t *existing, *var;
+ config_entry_list *existing, *var;
int error = 0;
- var = git__calloc(1, sizeof(cvar_t));
+ var = git__calloc(1, sizeof(config_entry_list));
GITERR_CHECK_ALLOC(var);
var->entry = entry;
@@ -146,14 +146,14 @@ static int append_entry(git_strmap *values, git_config_entry *entry)
static void free_vars(git_strmap *values)
{
- cvar_t *var = NULL;
+ config_entry_list *var = NULL;
if (values == NULL)
return;
git_strmap_foreach_value(values, var,
while (var != NULL) {
- cvar_t *next = var->next;
+ config_entry_list *next = var->next;
cvar_free(var);
var = next;
});
@@ -358,7 +358,7 @@ static int config_iterator_next(
diskfile_header *h = (diskfile_header *) it->parent.backend;
git_strmap *values = h->values->values;
int err = 0;
- cvar_t * var;
+ config_entry_list * var;
if (it->next_var == NULL) {
err = git_strmap_next((void**) &var, &(it->iter), values);
@@ -434,7 +434,7 @@ static int config_set(git_config_backend *cfg, const char *name, const char *val
*/
pos = git_strmap_lookup_index(values, key);
if (git_strmap_valid_index(values, pos)) {
- cvar_t *existing = git_strmap_value_at(values, pos);
+ config_entry_list *existing = git_strmap_value_at(values, pos);
if (existing->next != NULL) {
giterr_set(GITERR_CONFIG, "multivar incompatible with simple set");
@@ -492,7 +492,7 @@ static int config_get(git_config_backend *cfg, const char *key, git_config_entry
refcounted_strmap *map;
git_strmap *values;
khiter_t pos;
- cvar_t *var;
+ config_entry_list *var;
int error = 0;
if (!h->parent.readonly && ((error = config_refresh(cfg)) < 0))
@@ -556,7 +556,7 @@ out:
static int config_delete(git_config_backend *cfg, const char *name)
{
- cvar_t *var;
+ config_entry_list *var;
diskfile_backend *b = (diskfile_backend *)cfg;
refcounted_strmap *map; git_strmap *values;
char *key;