From af5cd5002b40aff1bb55f17e1bc57ec85b51e086 Mon Sep 17 00:00:00 2001 From: Ryan Lee Date: Wed, 13 Nov 2024 10:18:19 -0800 Subject: [PATCH] Remove unused and broken dup_value_list function This function was broken all this time: instead of duplicating each entry in the list, it would duplicate the first entry n times. Since this function is currently not used anywhere, delete it instead of fixing it. Signed-off-by: Ryan Lee --- parser/parser.h | 1 - parser/parser_misc.c | 31 ------------------------------- 2 files changed, 32 deletions(-) diff --git a/parser/parser.h b/parser/parser.h index 2d46ce3f3..67322e37e 100644 --- a/parser/parser.h +++ b/parser/parser.h @@ -436,7 +436,6 @@ extern void free_var_string(struct var_string *var); extern void warn_uppercase(void); extern int is_blacklisted(const char *name, const char *path); extern struct value_list *new_value_list(char *value); -extern struct value_list *dup_value_list(struct value_list *list); extern void free_value_list(struct value_list *list); extern void print_value_list(struct value_list *list); extern struct cond_entry *new_cond_entry(char *name, int eq, struct value_list *list); diff --git a/parser/parser_misc.c b/parser/parser_misc.c index bdbe4bb65..09dd490f0 100644 --- a/parser/parser_misc.c +++ b/parser/parser_misc.c @@ -1196,37 +1196,6 @@ void free_value_list(struct value_list *list) } } -struct value_list *dup_value_list(struct value_list *list) -{ - struct value_list *entry, *dup, *head = NULL; - char *value; - - list_for_each(list, entry) { - value = NULL; - if (list->value) { - value = strdup(list->value); - if (!value) - goto fail2; - } - dup = new_value_list(value); - if (!dup) - goto fail; - if (head) - list_append(head, dup); - else - head = dup; - } - - return head; - -fail: - free(value); -fail2: - free_value_list(head); - - return NULL; -} - void print_value_list(struct value_list *list) { struct value_list *entry;