UCI_HANDLE_ERR(ctx);
/* make sure no memory from previous parse attempts is leaked */
- ctx->internal = true;
uci_cleanup(ctx);
uci_alloc_parse_context(ctx);
/* flush unsaved changes and reload from history file */
UCI_TRAP_SAVE(ctx, done);
- if (p->confdir) {
+ if (p->has_history) {
if (!overwrite) {
name = uci_strdup(ctx, p->e.name);
path = uci_strdup(ctx, p->path);
UCI_INTERNAL(uci_import, ctx, f, name, &p, true);
p->path = path;
- p->confdir = true;
+ p->has_history = true;
*package = p;
/* freed together with the uci_package */
if (package) {
package->path = filename;
- package->confdir = confdir;
+ package->has_history = confdir;
uci_load_history(ctx, package, false);
}
FILE *f = NULL;
int changes = 0;
- if (!p->confdir)
+ if (!p->has_history)
return 0;
uci_foreach_element(&ctx->history_path, e) {
UCI_ASSERT(ctx, pkg != NULL);
p = *pkg;
UCI_ASSERT(ctx, p != NULL);
- UCI_ASSERT(ctx, p->confdir);
+ UCI_ASSERT(ctx, p->has_history);
/*
* - flush unwritten changes
* directly.
* does not modify the uci_package pointer
*/
- if (!p->confdir)
+ if (!p->has_history)
return uci_commit(ctx, &p, false);
if (uci_list_empty(&p->history))
}
p = s->package;
- if (!internal && p->confdir)
+ if (!internal && p->has_history)
uci_add_history(ctx, &p->history, UCI_CMD_REMOVE, s->e.name, option, NULL);
switch(e->type) {
return 0;
}
p = s->package;
- if (!internal && p->confdir)
+ if (!internal && p->has_history)
uci_add_history(ctx, &p->history, UCI_CMD_CHANGE, section, option, value);
uci_list_del(&e->list);
/* NB: p, section, option validated by uci_lookup */
UCI_INTERNAL(uci_lookup, ctx, &e, p, section, option);
- if (!internal && p->confdir)
+ if (!internal && p->has_history)
uci_add_history(ctx, &p->history, UCI_CMD_RENAME, section, option, name);
name = uci_strdup(ctx, name);
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
/* now add the missing entry */
- if (!internal && p->confdir)
+ if (!internal && p->has_history)
uci_add_history(ctx, &p->history, UCI_CMD_CHANGE, section, option, value);
if (s) {
o = uci_alloc_option(s, option, value);