n->flags = s->flags | os->flags | os->valid_flags;
}
-static void
-device_add_extra_vlan(struct device *dev, const char *val)
+static bool device_fill_vlan_range(struct device_vlan_range *r, const char *val)
{
unsigned long cur_start, cur_end;
char *sep;
if (*sep == '-')
cur_end = strtoul(sep + 1, &sep, 0);
if (*sep || cur_end < cur_start)
- return;
+ return false;
+
+ r->start = cur_start;
+ r->end = cur_end;
- dev->extra_vlan[dev->n_extra_vlan].start = cur_start;
- dev->extra_vlan[dev->n_extra_vlan].end = cur_end;
- dev->n_extra_vlan++;
+ return true;
}
static void
dev->extra_vlan = realloc(dev->extra_vlan, n_vlans * sizeof(*dev->extra_vlan));
blobmsg_for_each_attr(cur, data, rem)
- device_add_extra_vlan(dev, blobmsg_get_string(cur));
+ if (device_fill_vlan_range(&dev->extra_vlan[dev->n_extra_vlan],
+ blobmsg_get_string(cur)))
+ dev->n_extra_vlan++;
}
void