Skip to content

Commit 2d1f667

Browse files
committed
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 parent 26cf48f commit 2d1f667

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

src/config_file.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
#include <sys/types.h>
2424
#include <regex.h>
2525

26-
typedef struct cvar_t {
27-
struct cvar_t *next;
26+
typedef struct config_entry_list {
27+
struct config_entry_list *next;
2828
git_config_entry *entry;
29-
} cvar_t;
29+
} config_entry_list;
3030

3131
typedef struct git_config_file_iter {
3232
git_config_iterator parent;
3333
git_strmap_iter iter;
34-
cvar_t* next_var;
34+
config_entry_list* next_var;
3535
} git_config_file_iter;
3636

3737
/* Max depth for [include] directives */
@@ -82,7 +82,7 @@ static int config_error_readonly(void)
8282
return -1;
8383
}
8484

85-
static void cvar_free(cvar_t *var)
85+
static void cvar_free(config_entry_list *var)
8686
{
8787
if (var == NULL)
8888
return;
@@ -120,10 +120,10 @@ int git_config_file_normalize_section(char *start, char *end)
120120
static int append_entry(git_strmap *values, git_config_entry *entry)
121121
{
122122
git_strmap_iter pos;
123-
cvar_t *existing, *var;
123+
config_entry_list *existing, *var;
124124
int error = 0;
125125

126-
var = git__calloc(1, sizeof(cvar_t));
126+
var = git__calloc(1, sizeof(config_entry_list));
127127
GITERR_CHECK_ALLOC(var);
128128
var->entry = entry;
129129

@@ -146,14 +146,14 @@ static int append_entry(git_strmap *values, git_config_entry *entry)
146146

147147
static void free_vars(git_strmap *values)
148148
{
149-
cvar_t *var = NULL;
149+
config_entry_list *var = NULL;
150150

151151
if (values == NULL)
152152
return;
153153

154154
git_strmap_foreach_value(values, var,
155155
while (var != NULL) {
156-
cvar_t *next = var->next;
156+
config_entry_list *next = var->next;
157157
cvar_free(var);
158158
var = next;
159159
});
@@ -358,7 +358,7 @@ static int config_iterator_next(
358358
diskfile_header *h = (diskfile_header *) it->parent.backend;
359359
git_strmap *values = h->values->values;
360360
int err = 0;
361-
cvar_t * var;
361+
config_entry_list * var;
362362

363363
if (it->next_var == NULL) {
364364
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
434434
*/
435435
pos = git_strmap_lookup_index(values, key);
436436
if (git_strmap_valid_index(values, pos)) {
437-
cvar_t *existing = git_strmap_value_at(values, pos);
437+
config_entry_list *existing = git_strmap_value_at(values, pos);
438438

439439
if (existing->next != NULL) {
440440
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
492492
refcounted_strmap *map;
493493
git_strmap *values;
494494
khiter_t pos;
495-
cvar_t *var;
495+
config_entry_list *var;
496496
int error = 0;
497497

498498
if (!h->parent.readonly && ((error = config_refresh(cfg)) < 0))
@@ -556,7 +556,7 @@ static int config_set_multivar(
556556

557557
static int config_delete(git_config_backend *cfg, const char *name)
558558
{
559-
cvar_t *var;
559+
config_entry_list *var;
560560
diskfile_backend *b = (diskfile_backend *)cfg;
561561
refcounted_strmap *map; git_strmap *values;
562562
char *key;

0 commit comments

Comments
 (0)