projects
/
project
/
uci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
implement config unload
[project/uci.git]
/
parse.c
diff --git
a/parse.c
b/parse.c
index
5158028
..
4394bf6
100644
(file)
--- a/
parse.c
+++ b/
parse.c
@@
-80,7
+80,7
@@
static void uci_parse_cleanup(struct uci_context *ctx)
ctx->pctx = NULL;
if (pctx->cfg) {
uci_list_del(&pctx->cfg->list);
ctx->pctx = NULL;
if (pctx->cfg) {
uci_list_del(&pctx->cfg->list);
- uci_drop_
file
(pctx->cfg);
+ uci_drop_
config
(pctx->cfg);
}
if (pctx->buf)
free(pctx->buf);
}
if (pctx->buf)
free(pctx->buf);
@@
-314,6
+314,11
@@
int uci_load(struct uci_context *ctx, const char *name)
UCI_HANDLE_ERR(ctx);
UCI_ASSERT(ctx, name != NULL);
UCI_HANDLE_ERR(ctx);
UCI_ASSERT(ctx, name != NULL);
+ UCI_TRAP_SAVE(ctx, ignore);
+ uci_unload(ctx, name);
+ UCI_TRAP_RESTORE(ctx);
+
+ignore:
/* make sure no memory from previous parse attempts is leaked */
uci_parse_cleanup(ctx);
/* make sure no memory from previous parse attempts is leaked */
uci_parse_cleanup(ctx);
@@
-345,7
+350,7
@@
int uci_load(struct uci_context *ctx, const char *name)
if (!pctx->file)
UCI_THROW(ctx, UCI_ERR_IO);
if (!pctx->file)
UCI_THROW(ctx, UCI_ERR_IO);
- pctx->cfg = uci_alloc_
file
(ctx, name);
+ pctx->cfg = uci_alloc_
config
(ctx, name);
while (!feof(pctx->file)) {
uci_getln(ctx);
while (!feof(pctx->file)) {
uci_getln(ctx);