-int uci_lookup(struct uci_context *ctx, struct uci_element **res, struct uci_package *p, char *section, char *option)
+int uci_lookup(struct uci_context *ctx, struct uci_element **res, struct uci_package *p, const char *section, const char *option)
UCI_HANDLE_ERR(ctx);
UCI_ASSERT(ctx, res != NULL);
UCI_ASSERT(ctx, p != NULL);
UCI_HANDLE_ERR(ctx);
UCI_ASSERT(ctx, res != NULL);
UCI_ASSERT(ctx, p != NULL);
uci_add_history(ctx, &p->history, UCI_CMD_REMOVE, s->e.name, option, NULL);
switch(e->type) {
uci_add_history(ctx, &p->history, UCI_CMD_REMOVE, s->e.name, option, NULL);
switch(e->type) {
uci_add_history(ctx, &p->history, UCI_CMD_CHANGE, section, option, value);
uci_list_del(&e->list);
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);
/* NB: p, section, option validated by uci_lookup */
UCI_INTERNAL(uci_lookup, ctx, &e, p, section, option);
uci_add_history(ctx, &p->history, UCI_CMD_RENAME, section, option, name);
name = uci_strdup(ctx, name);
uci_add_history(ctx, &p->history, UCI_CMD_RENAME, section, option, name);
name = uci_strdup(ctx, name);
-int uci_add_section(struct uci_context *ctx, struct uci_package *p, char *type, struct uci_section **res)
+int uci_add_section(struct uci_context *ctx, struct uci_package *p, const char *type, struct uci_section **res)
s = uci_alloc_section(p, type, NULL);
uci_fixup_section(ctx, s);
*res = s;
s = uci_alloc_section(p, type, NULL);
uci_fixup_section(ctx, s);
*res = s;
- uci_add_history(ctx, &p->history, UCI_CMD_ADD, s->e.name, NULL, type);
+ if (!internal && p->has_history)
+ uci_add_history(ctx, &p->history, UCI_CMD_ADD, s->e.name, NULL, type);
-int uci_delete(struct uci_context *ctx, struct uci_package *p, char *section, char *option)
+int uci_delete(struct uci_context *ctx, struct uci_package *p, const char *section, const char *option)
-int uci_set(struct uci_context *ctx, struct uci_package *p, char *section, char *option, char *value, struct uci_element **result)
+int uci_set(struct uci_context *ctx, struct uci_package *p, const char *section, const char *option, const char *value, struct uci_element **result)
* if the section/option is to be modified and it is not found
* create a new element in the appropriate list
*/
* if the section/option is to be modified and it is not found
* create a new element in the appropriate list
*/
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
/* now add the missing entry */
UCI_THROW(ctx, UCI_ERR_NOTFOUND);
/* now add the missing entry */
uci_add_history(ctx, &p->history, UCI_CMD_CHANGE, section, option, value);
if (s) {
o = uci_alloc_option(s, option, value);
uci_add_history(ctx, &p->history, UCI_CMD_CHANGE, section, option, value);
if (s) {
o = uci_alloc_option(s, option, value);