config_file: remove unused list iteration macros We currently provide a lot of macros for the `cvar_t` structure which are never being used. In fact, the only macro we need is to access the `next` pointer of `cvar_t`, which really does not require a macro at all. Remove all these macros and replace usage of `CVAR_LIST_NEXT(cvar)` with `cvar->next`.
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
diff --git a/src/config_file.c b/src/config_file.c
index aa9e83b..6890af6 100644
--- a/src/config_file.c
+++ b/src/config_file.c
@@ -38,44 +38,6 @@ typedef struct git_config_file_iter {
/* Max depth for [include] directives */
#define MAX_INCLUDE_DEPTH 10
-#define CVAR_LIST_HEAD(list) ((list)->head)
-
-#define CVAR_LIST_TAIL(list) ((list)->tail)
-
-#define CVAR_LIST_NEXT(var) ((var)->next)
-
-#define CVAR_LIST_EMPTY(list) ((list)->head == NULL)
-
-#define CVAR_LIST_APPEND(list, var) do {\
- if (CVAR_LIST_EMPTY(list)) {\
- CVAR_LIST_HEAD(list) = CVAR_LIST_TAIL(list) = var;\
- } else {\
- CVAR_LIST_NEXT(CVAR_LIST_TAIL(list)) = var;\
- CVAR_LIST_TAIL(list) = var;\
- }\
-} while(0)
-
-#define CVAR_LIST_REMOVE_HEAD(list) do {\
- CVAR_LIST_HEAD(list) = CVAR_LIST_NEXT(CVAR_LIST_HEAD(list));\
-} while(0)
-
-#define CVAR_LIST_REMOVE_AFTER(var) do {\
- CVAR_LIST_NEXT(var) = CVAR_LIST_NEXT(CVAR_LIST_NEXT(var));\
-} while(0)
-
-#define CVAR_LIST_FOREACH(list, iter)\
- for ((iter) = CVAR_LIST_HEAD(list);\
- (iter) != NULL;\
- (iter) = CVAR_LIST_NEXT(iter))
-
-/*
- * Inspired by the FreeBSD functions
- */
-#define CVAR_LIST_FOREACH_SAFE(start, iter, tmp)\
- for ((iter) = CVAR_LIST_HEAD(vars);\
- (iter) && (((tmp) = CVAR_LIST_NEXT(iter) || 1));\
- (iter) = (tmp))
-
typedef struct {
git_atomic refcount;
git_strmap *values;
@@ -188,7 +150,7 @@ static void free_vars(git_strmap *values)
git_strmap_foreach_value(values, var,
while (var != NULL) {
- cvar_t *next = CVAR_LIST_NEXT(var);
+ cvar_t *next = var->next;
cvar_free(var);
var = next;
});
@@ -407,7 +369,7 @@ static int config_iterator_next(
}
*entry = var->entry;
- it->next_var = CVAR_LIST_NEXT(var);
+ it->next_var = var->next;
return 0;
}