]> pilppa.com Git - uci.git/commitdiff
cleanup
authorFelix Fietkau <nbd@openwrt.org>
Mon, 28 Jan 2008 03:50:45 +0000 (04:50 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 28 Jan 2008 03:50:45 +0000 (04:50 +0100)
file.c
libuci.c
uci.h

diff --git a/file.c b/file.c
index 412ce138680e0bf56d423e6845eb839229c93bed..9a2e353fe92e77a65893d3536e6c52eab623ca14 100644 (file)
--- a/file.c
+++ b/file.c
@@ -293,14 +293,9 @@ static void uci_switch_config(struct uci_context *ctx)
         * if an older config under the same name exists, unload it
         * ignore errors here, e.g. if the config was not found
         */
-       UCI_TRAP_SAVE(ctx, ignore);
        e = uci_lookup_list(ctx, &ctx->root, name);
        if (e)
-               uci_unload(ctx, uci_to_package(e));
-       UCI_TRAP_RESTORE(ctx);
-ignore:
-       ctx->errno = 0;
-
+               UCI_THROW(ctx, UCI_ERR_DUPLICATE);
        pctx->package = uci_alloc_package(ctx, name);
 }
 
index c0b4ab01571a18f2b4ed86d1bfeb38034e410e5e..74b3d7b935ecf2fd9d0f2b8fd1d69542c8389774 100644 (file)
--- a/libuci.c
+++ b/libuci.c
 #include "err.h"
 
 static const char *uci_errstr[] = {
-       [UCI_OK] =           "Success",
-       [UCI_ERR_MEM] =      "Out of memory",
-       [UCI_ERR_INVAL] =    "Invalid argument",
-       [UCI_ERR_NOTFOUND] = "Entry not found",
-       [UCI_ERR_IO] =       "I/O error",
-       [UCI_ERR_PARSE] =    "Parse error",
-       [UCI_ERR_UNKNOWN] =  "Unknown error",
+       [UCI_OK] =            "Success",
+       [UCI_ERR_MEM] =       "Out of memory",
+       [UCI_ERR_INVAL] =     "Invalid argument",
+       [UCI_ERR_NOTFOUND] =  "Entry not found",
+       [UCI_ERR_IO] =        "I/O error",
+       [UCI_ERR_PARSE] =     "Parse error",
+       [UCI_ERR_DUPLICATE] = "Duplicate entry",
+       [UCI_ERR_UNKNOWN] =   "Unknown error",
 };
 
 #include "util.c"
diff --git a/uci.h b/uci.h
index 3b597db275900bab8973186cb53bf7151db4140a..c7251abce822f7bf83fb2d6781801f2a34434681 100644 (file)
--- a/uci.h
+++ b/uci.h
@@ -43,6 +43,7 @@ enum
        UCI_ERR_NOTFOUND,
        UCI_ERR_IO,
        UCI_ERR_PARSE,
+       UCI_ERR_DUPLICATE,
        UCI_ERR_UNKNOWN,
        UCI_ERR_LAST
 };