]> pilppa.com Git - uci.git/commitdiff
make the uci_ptr struct reusable after a call to uci_delete()
authorFelix Fietkau <nbd@openwrt.org>
Tue, 20 Jan 2009 00:07:28 +0000 (01:07 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Tue, 20 Jan 2009 00:07:28 +0000 (01:07 +0100)
list.c

diff --git a/list.c b/list.c
index cd6d30522941f4d0411293d3a1e3c2f127dd57e7..9486ffba17d1f9b871d3709921fb8e499bfd9dfe 100644 (file)
--- a/list.c
+++ b/list.c
@@ -567,6 +567,12 @@ int uci_delete(struct uci_context *ctx, struct uci_ptr *ptr)
                uci_add_history(ctx, &p->history, UCI_CMD_REMOVE, ptr->section, ptr->option, NULL);
 
        uci_free_any(&e);
+
+       if (ptr->option)
+               ptr->o = NULL;
+       else if (ptr->section)
+               ptr->s = NULL;
+
        return 0;
 }