else return strcmp(((struct config_value *)a)->name, ((struct config_value *)b)->name);
}
-#define config_value_index_add(co, cv) avl_insert_lock(&((co)->values_index), (avl *)(cv))
-#define config_value_index_del(co, cv) avl_remove_lock(&((co)->values_index), (avl *)(cv))
+#define config_value_index_add(co, cv) (struct config_value *)avl_insert_lock(&((co)->values_index), (avl *)(cv))
+#define config_value_index_del(co, cv) (struct config_value *)avl_remove_lock(&((co)->values_index), (avl *)(cv))
static struct config_value *config_value_index_find(struct config *co, const char *name, uint32_t hash) {
struct config_value tmp;
AVL_LOCK_INITIALIZER
};
-#define config_index_add(cfg) avl_insert_lock(&config_root_index, (avl *)(cfg))
-#define config_index_del(cfg) avl_remove_lock(&config_root_index, (avl *)(cfg))
+#define config_index_add(cfg) (struct config *)avl_insert_lock(&config_root_index, (avl *)(cfg))
+#define config_index_del(cfg) (struct config *)avl_remove_lock(&config_root_index, (avl *)(cfg))
static struct config *config_index_find(const char *name, uint32_t hash) {
struct config tmp;
avl_init_lock(&co->values_index, config_value_compare);
- config_index_add(co);
+ if(unlikely(config_index_add(co) != co))
+ error("INTERNAL ERROR: indexing of section '%s', already exists.", co->name);
config_global_write_lock();
struct config *co2 = config_root;
cv->hash = simple_hash(cv->name);
cv->value = strdupz(value);
- config_value_index_add(co, cv);
+ if(unlikely(config_value_index_add(co, cv) != cv))
+ error("INTERNAL ERROR: indexing of config '%s' in section '%s': already exists.", cv->name, co->name);
config_section_write_lock(co);
struct config_value *cv2 = co->values;
cv2 = config_value_index_find(co, new, 0);
if(cv2) goto cleanup;
- config_value_index_del(co, cv);
+ if(unlikely(config_value_index_del(co, cv) != cv))
+ error("INTERNAL ERROR: deletion of config '%s' from section '%s', deleted tge wrong config entry.", cv->name, co->name);
freez(cv->name);
cv->name = strdupz(new);
-
cv->hash = simple_hash(cv->name);
+ if(unlikely(config_value_index_add(co, cv) != cv))
+ error("INTERNAL ERROR: indexing of config '%s' in section '%s', already exists.", cv->name, co->name);
- config_value_index_add(co, cv);
config_section_unlock(co);
return 0;
config_global_write_lock();
for(co = config_root; co ; co = co->next) {
if(!strcmp(co->name, "global") ||
- !strcmp(co->name, "plugins") ||
+ !strcmp(co->name, "plugins") ||
!strcmp(co->name, "registry") ||
- !strcmp(co->name, "health"))
+ !strcmp(co->name, "health") ||
+ !strcmp(co->name, "backend"))
pri = 0;
else if(!strncmp(co->name, "plugin:", 7)) pri = 1;
else pri = 2;