This is just a cleanup.
fatal_signal_add_hook(unlink_files, cancel_files, NULL, true);
}
- if (!shash_find(&files, file)) {
- shash_add(&files, file, NULL);
- }
+ shash_add_once(&files, file, NULL);
}
/* Unregisters 'file' from being unlinked when the program terminates via
{
struct netdev_monitor *monitor = notifier->aux;
const char *name = netdev_get_name(notifier->netdev);
- if (!shash_find(&monitor->changed_netdevs, name)) {
- shash_add(&monitor->changed_netdevs, name, NULL);
- }
+ shash_add_once(&monitor->changed_netdevs, name, NULL);
}
/* Attempts to add 'netdev' as a netdev monitored by 'monitor'. Returns 0 if
struct ovsdb_idl_table *table = &idl->tables[i];
size_t j;
- assert(!shash_find(&idl->table_by_name, tc->name));
- shash_add(&idl->table_by_name, tc->name, table);
+ shash_add_assert(&idl->table_by_name, tc->name, table);
table->class = tc;
shash_init(&table->columns);
for (j = 0; j < tc->n_columns; j++) {
const struct ovsdb_idl_column *column = &tc->columns[j];
- assert(!shash_find(&table->columns, column->name));
- shash_add(&table->columns, column->name, column);
+ shash_add_assert(&table->columns, column->name, column);
}
hmap_init(&table->rows);
table->idl = idl;
shash_init(&cur_ifaces);
for (i = 0; i < n_dpif_ports; i++) {
const char *name = dpif_ports[i].devname;
- if (!shash_find(&cur_ifaces, name)) {
- shash_add(&cur_ifaces, name, NULL);
- }
+ shash_add_once(&cur_ifaces, name, NULL);
}
free(dpif_ports);