bool
svec_contains(const struct svec *svec, const char *name)
{
+ assert(svec_is_sorted(svec));
return bsearch(&name, svec->names, svec->n, sizeof *svec->names,
compare_strings) != NULL;
}
LIST_FOR_EACH (br, struct bridge, node, &all_bridges) {
svec_add(&old_br, br->name);
}
- svec_sort(&old_br);
cfg_get_subsections(&new_br, "bridge");
/* Get rid of deleted bridges and add new bridges. */
+ svec_sort(&old_br);
+ svec_sort(&new_br);
LIST_FOR_EACH_SAFE (br, next, struct bridge, node, &all_bridges) {
if (!svec_contains(&new_br, br->name)) {
bridge_destroy(br);
cfg_get_all_keys(&new_ports, "bridge.%s.port", br->name);
/* Get rid of deleted ports and add new ports. */
+ svec_sort(&old_ports);
+ svec_sort(&new_ports);
for (i = 0; i < br->n_ports; ) {
struct port *port = br->ports[i];
if (!svec_contains(&new_ports, port->name)) {