remove internal usage of redundant uci_ptr.last
[project/uci.git] / list.c
diff --git a/list.c b/list.c
index 16402130ebf2d87751c3ab7466155e9e4bcebc60..304c9e1fd1b279181345e841e28430b485eb76d6 100644 (file)
--- a/list.c
+++ b/list.c
@@ -616,7 +616,6 @@ int uci_add_list(struct uci_context *ctx, struct uci_ptr *ptr)
                UCI_TRAP_SAVE(ctx, error);
                ptr->o = uci_alloc_list(ptr->s, ptr->option, NULL);
                UCI_TRAP_RESTORE(ctx);
-               ptr->last = &ptr->o->e;
        } else if (ptr->o->type == UCI_TYPE_STRING) {
                /* create new list and add old string value as item to list */
                struct uci_option *old = ptr->o;
@@ -630,7 +629,6 @@ int uci_add_list(struct uci_context *ctx, struct uci_ptr *ptr)
                if (ptr->option == old->e.name)
                        ptr->option = ptr->o->e.name;
                uci_free_option(old);
-               ptr->last = &ptr->o->e;
        }
 
        /* add new item to list */
@@ -708,10 +706,8 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
                return uci_delete(ctx, ptr);
        } else if (!ptr->o && ptr->option) { /* new option */
                ptr->o = uci_alloc_option(ptr->s, ptr->option, ptr->value, NULL);
-               ptr->last = &ptr->o->e;
        } else if (!ptr->s && ptr->section) { /* new section */
                ptr->s = uci_alloc_section(ptr->p, ptr->value, ptr->section, NULL);
-               ptr->last = &ptr->s->e;
        } else if (ptr->o && ptr->option) { /* update option */
                if (ptr->o->type == UCI_TYPE_STRING && !strcmp(ptr->o->v.string, ptr->value))
                        return 0;
@@ -724,7 +720,6 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
                        if (ptr->option == old->e.name)
                                ptr->option = ptr->o->e.name;
                        uci_free_option(old);
-                       ptr->last = &ptr->o->e;
                }
        } else if (ptr->s && ptr->section) { /* update section */
                if (!strcmp(ptr->s->type, ptr->value))
@@ -740,7 +735,6 @@ int uci_set(struct uci_context *ctx, struct uci_ptr *ptr)
                                ptr->section = ptr->s->e.name;
                        uci_free_section(old);
                        ptr->s->package->n_section--;
-                       ptr->last = &ptr->s->e;
                }
        } else {
                UCI_THROW(ctx, UCI_ERR_INVAL);