char *value = NULL;
struct uci_ptr ptr;
+ if (!p)
+ return NULL;
+
memset(&ptr, 0, sizeof(ptr));
ptr.package = p->e.name;
ptr.section = section;
{
struct uci_element *e;
+ if (!p)
+ return;
+
uci_foreach_element(&p->sections, e)
if (!strcmp(type, uci_to_section(e)->type))
cb(e->name, priv);
struct uci_context* ucix_init(const char *config_file)
{
struct uci_context *ctx = uci_alloc_context();
+ if(!ctx)
+ return NULL;
uci_add_delta_path(ctx, "/var/state");
if(uci_load(ctx, config_file, NULL) != UCI_OK)
{
struct uci_context* ucix_init_path(const char *path, const char *config_file)
{
struct uci_context *ctx = uci_alloc_context();
+ if(!ctx)
+ return NULL;
if(path)
{
uci_set_savedir(ctx, path);
void ucix_cleanup(struct uci_context *ctx)
{
- uci_free_context(ctx);
+ if(ctx)
+ {
+ uci_free_context(ctx);
+ }
}
int ucix_save(struct uci_context *ctx, const char *p)