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
ucimap_add_fixup(sd, data, om, str);
return;
case UCIMAP_CUSTOM:
- tdata.s = (char *) data;
break;
}
if (om->parse) {
- if (om->parse(ucimap_section_ptr(sd), om, &tdata, str) < 0)
+ if (om->parse(ucimap_section_ptr(sd), om, data, str) < 0)
return;
if (ucimap_is_custom(om->type) && om->free) {
if (tdata.ptr != data->ptr)
}
if (om->format) {
- union ucimap_data tdata;
-
- if (ucimap_is_custom(om->type)) {
- tdata.s = (char *)data;
- data = &tdata;
- }
-
if (om->format(ucimap_section_ptr(sd), om, data, &str) < 0)
return NULL;
} else {
sd = malloc(sm->alloc_len);
memset(sd, 0, sm->alloc_len);
+ sd = ucimap_ptr_section(sm, sd);
}
if (!sd)
continue;