* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Lesser General Public License for more details.
*/
/*
static inline bool
ucimap_is_alloc(enum ucimap_type type)
{
- switch(type & UCIMAP_SUBTYPE) {
- case UCIMAP_STRING:
- return true;
- default:
- return false;
- }
+ return (type & UCIMAP_SUBTYPE) == UCIMAP_STRING;
}
static inline bool
ucimap_is_fixup(enum ucimap_type type)
{
- switch(type & UCIMAP_SUBTYPE) {
- case UCIMAP_SECTION:
- return true;
- default:
- return false;
- }
+ return (type & UCIMAP_SUBTYPE) == UCIMAP_SECTION;
}
static inline bool
void
ucimap_cleanup(struct uci_map *map)
{
- struct ucimap_section_data *sd;
+ struct ucimap_section_data *sd, *sd_next;
- for (sd = map->sdata; sd; sd = sd->next) {
+ for (sd = map->sdata; sd; sd = sd_next) {
+ sd_next = sd->next;
ucimap_free_section(map, sd);
}
}
ucimap_handle_fixup(struct uci_map *map, struct ucimap_fixup *f)
{
void *ptr = ucimap_find_section(map, f);
- struct ucimap_list *list;
union ucimap_data *data;
if (!ptr)
f->data->ptr = ptr;
break;
case UCIMAP_LIST:
- list = f->data->list;
data = ucimap_list_append(f->data->list);
if (!data)
return false;
} else {
sd = malloc(sm->alloc_len);
memset(sd, 0, sm->alloc_len);
+ sd = ucimap_ptr_section(sm, sd);
}
if (!sd)
continue;