return 0;
}
+
+/*
+ * Empty callback for hash table initialization.
+ */
+static int null_callback(void *ctx, void *data)
+{
+ ctx = ctx; /* -Wunused */
+ data = data; /* -Wunused */
+
+ return 0;
+}
+
+
/*
* Initialize the directory, then fix the attr member of
* all attributes.
}
}
+ /*
+ * Walk over all of the hash tables to ensure they're
+ * initialized. We do this because the threads may perform
+ * lookups, and we don't want multi-threaded re-ordering
+ * of the table entries. That would be bad.
+ */
+ lrad_hash_table_walk(vendors_byname, null_callback, NULL);
+ lrad_hash_table_walk(vendors_byvalue, null_callback, NULL);
+
+ lrad_hash_table_walk(attributes_byname, null_callback, NULL);
+ lrad_hash_table_walk(attributes_byvalue, null_callback, NULL);
+
+ lrad_hash_table_walk(values_byvalue, null_callback, NULL);
+ lrad_hash_table_walk(values_byname, null_callback, NULL);
+
return 0;
}
if (!ht || !callback) return 0;
- for (i = 0; i < ht->num_buckets; i++) {
+ for (i = ht->num_buckets - 1; i >= 0; i--) {
lrad_hash_entry_t *node, *next;
- if (!ht->buckets[i]) continue;
+ /*
+ * Ensure that the current bucket is filled.
+ */
+ if (!ht->buckets[i]) lrad_hash_table_fixup(ht, i);
for (node = ht->buckets[i]; node != &ht->null; node = next) {
next = node->next;