uci_revert api cleanup
[project/uci.git] / cli.c
diff --git a/cli.c b/cli.c
index 5a260ef44907f87ce412b84ea95d043cdc0a042f..a1f4ce35f97a10bba7f00561d8b1cb4eed915efb 100644 (file)
--- a/cli.c
+++ b/cli.c
@@ -187,13 +187,7 @@ static int package_cmd(int cmd, char *tuple)
                return 1;
        }
 
-       if (ptr.o)
-               e = &ptr.o->e;
-       else if (ptr.s)
-               e = &ptr.s->e;
-       else
-               e = &ptr.p->e;
-
+       e = ptr.last;
        switch(cmd) {
        case CMD_CHANGES:
                uci_show_changes(ptr.p);
@@ -341,13 +335,7 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
        if (ptr.value && (cmd != CMD_SET) && (cmd != CMD_ADD_LIST) && (cmd != CMD_RENAME))
                return 1;
 
-       if (ptr.o)
-               e = &ptr.o->e;
-       else if (ptr.s)
-               e = &ptr.s->e;
-       else
-               e = &ptr.p->e;
-
+       e = ptr.last;
        switch(cmd) {
        case CMD_GET:
                switch(e->type) {
@@ -366,7 +354,7 @@ static int uci_do_section_cmd(int cmd, int argc, char **argv)
                ret = uci_rename(ctx, &ptr);
                break;
        case CMD_REVERT:
-               ret = uci_revert(ctx, &ptr.p, ptr.section, ptr.option);
+               ret = uci_revert(ctx, &ptr);
                break;
        case CMD_SET:
                ret = uci_set(ctx, ptr.p, ptr.section, ptr.option, ptr.value, NULL);