X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fuci.git;a=blobdiff_plain;f=history.c;h=73c1bf06ffaf845018009523dfc26303b11a5df3;hp=6be8a9d155300a14f4e9de9b714e6d722d773369;hb=f1ae2ddc4ff16e541c46f595073bf277cd8f778a;hpb=8dd3eb50025224bd2aa286c0e5c27d230efb7bde diff --git a/history.c b/history.c index 6be8a9d..73c1bf0 100644 --- a/history.c +++ b/history.c @@ -239,11 +239,11 @@ static int uci_load_history(struct uci_context *ctx, struct uci_package *p, bool if (filename) free(filename); uci_close_stream(f); - ctx->errno = 0; + ctx->err = 0; return changes; } -static void uci_filter_history(struct uci_context *ctx, const char *name, char *section, char *option) +static void uci_filter_history(struct uci_context *ctx, const char *name, const char *section, const char *option) { struct uci_parse_context *pctx; struct uci_element *e, *tmp; @@ -312,7 +312,7 @@ done: uci_cleanup(ctx); } -int uci_revert(struct uci_context *ctx, struct uci_package **pkg, char *section, char *option) +int uci_revert(struct uci_context *ctx, struct uci_package **pkg, const char *section, const char *option) { struct uci_package *p; char *name = NULL; @@ -340,13 +340,13 @@ int uci_revert(struct uci_context *ctx, struct uci_package **pkg, char *section, UCI_INTERNAL(uci_load, ctx, name, &p); UCI_TRAP_RESTORE(ctx); - ctx->errno = 0; + ctx->err = 0; error: if (name) free(name); - if (ctx->errno) - UCI_THROW(ctx, ctx->errno); + if (ctx->err) + UCI_THROW(ctx, ctx->err); return 0; } @@ -380,7 +380,7 @@ int uci_save(struct uci_context *ctx, struct uci_package *p) if ((asprintf(&filename, "%s/%s", ctx->savedir, p->e.name) < 0) || !filename) UCI_THROW(ctx, UCI_ERR_MEM); - ctx->errno = 0; + ctx->err = 0; UCI_TRAP_SAVE(ctx, done); f = uci_open_stream(ctx, filename, SEEK_END, true, true); UCI_TRAP_RESTORE(ctx); @@ -417,8 +417,8 @@ done: uci_close_stream(f); if (filename) free(filename); - if (ctx->errno) - UCI_THROW(ctx, ctx->errno); + if (ctx->err) + UCI_THROW(ctx, ctx->err); return 0; }