* Register dictionary autoload callbacks
*/
dl_symbol_init_cb_register(dl_module_loader->dl_loader,
- DL_PRIORITY_DICT_ATTR, "dict_enum", fr_dl_dict_enum_autoload, NULL);
+ DL_PRIORITY_DICT_ENUM, "dict_enum", fr_dl_dict_enum_autoload, NULL);
dl_symbol_init_cb_register(dl_module_loader->dl_loader,
DL_PRIORITY_DICT_ATTR, "dict_attr", fr_dl_dict_attr_autoload, NULL);
dl_symbol_init_cb_register(dl_module_loader->dl_loader,
* The higher the priority, the earlier in callback gets called.
*/
#define DL_PRIORITY_DICT 30 //!< Callback priority for dictionary autoloading
-#define DL_PRIORITY_DICT_ATTR 20 //!< Callback priority for attribute resolution
+#define DL_PRIORITY_DICT_ATTR 29 //!< Callback priority for attribute resolution
+#define DL_PRIORITY_DICT_ENUM 28 //!< Callback priority for enum resolution
#define DL_PRIORITY_BOOTSTRAP 10 //!< Callback priority for bootstrap callback
typedef struct dl_module_loader_s dl_module_loader_t;
extern fr_table_num_sorted_t const dl_module_type_prefix[];
extern size_t dl_module_type_prefix_len;
-/** Callback priorities
- *
- * The higher the priority, the earlier in callback gets called.
- */
-#define DL_PRIORITY_DICT 30 //!< Callback priority for dictionary autoloading
-#define DL_PRIORITY_DICT_ATTR 20 //!< Callback priority for attribute resolution
-#define DL_PRIORITY_BOOTSTRAP 10 //!< Callback priority for bootstrap callback
-
dl_module_t const *dl_module(CONF_SECTION *conf, dl_module_t const *parent,
char const *name, dl_module_type_t type);
int dl_symbol_init_cb_register(dl_loader_t *dl_loader, unsigned int priority,
char const *symbol, dl_onload_t func, void *uctx)
{
- dl_symbol_init_t *n, *p = NULL;
+ dl_symbol_init_t *n;
dl_symbol_init_cb_unregister(dl_loader, symbol, func);
.uctx = uctx
};
- while ((p = fr_dlist_next(&dl_loader->sym_init, p)) && (p->priority >= priority));
- if (p) {
- fr_dlist_insert_after(&dl_loader->sym_init, p, n);
- } else {
- fr_dlist_insert_tail(&dl_loader->sym_init, n);
+ fr_dlist_foreach(&dl_loader->sym_init, dl_symbol_init_t, p) {
+ if (p->priority < priority) {
+ fr_dlist_insert_before(&dl_loader->sym_init, p, n);
+ n = NULL;
+ break;
+ }
}
+ if (n) fr_dlist_insert_tail(&dl_loader->sym_init, n);
return 0;
}
int dl_symbol_free_cb_register(dl_loader_t *dl_loader, unsigned int priority,
char const *symbol, dl_unload_t func, void *uctx)
{
- dl_symbol_free_t *n, *p = NULL;
+ dl_symbol_free_t *n;
dl_symbol_free_cb_unregister(dl_loader, symbol, func);
.uctx = uctx
};
- while ((p = fr_dlist_next(&dl_loader->sym_free, p)) && (p->priority >= priority));
- if (p) {
- fr_dlist_insert_after(&dl_loader->sym_free, p, n);
- } else {
- fr_dlist_insert_tail(&dl_loader->sym_free, n);
+ fr_dlist_foreach(&dl_loader->sym_free, dl_symbol_free_t, p) {
+ if (p->priority < priority) {
+ fr_dlist_insert_before(&dl_loader->sym_free, p, n);
+ n = NULL;
+ break;
+ }
}
+ if (n) fr_dlist_insert_tail(&dl_loader->sym_free, n);
return 0;
}