summaryrefslogtreecommitdiff
path: root/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/conf.c b/conf.c
index 912db783..d3702457 100644
--- a/conf.c
+++ b/conf.c
@@ -216,13 +216,23 @@ conf_setchanged (int c) {
void
conf_remove_items (const char *key) {
int l = strlen (key);
- DB_conf_item_t *it = conf_find (key, NULL);
+ DB_conf_item_t *prev = NULL;
+ DB_conf_item_t *it;
+ for (it = conf_items; it; prev = it, it = it->next) {
+ if (!strncasecmp (key, it->key, l)) {
+ break;
+ }
+ }
+ DB_conf_item_t *next = NULL;
while (it) {
- DB_conf_item_t *next = it->next;
+ next = it->next;
conf_item_free (it);
it = next;
- if (strncasecmp (key, it->key, l)) {
+ if (!it || strncasecmp (key, it->key, l)) {
break;
}
}
+ if (prev) {
+ prev->next = next;
+ }
}