Add load priority order, such that preload becomes unnecessary in most cases
[asterisk/asterisk.git] / cel / cel_tds.c
index 138a9cd..37992bf 100644 (file)
@@ -541,13 +541,9 @@ static int load_module(void)
        dberrhandle(tds_error_handler);
        dbmsghandle(tds_message_handler);
 
-       settings = ast_calloc(1, sizeof(*settings));
+       settings = ast_calloc_with_stringfields(1, struct cel_tds_config, 256);
 
-       if (!settings || ast_string_field_init(settings, 256)) {
-               if (settings) {
-                       ast_free(settings);
-                       settings = NULL;
-               }
+       if (!settings) {
                dbexit();
                return AST_MODULE_LOAD_DECLINE;
        }
@@ -580,8 +576,9 @@ static int unload_module(void)
        return tds_unload_module();
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "FreeTDS CEL Backend",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_LOAD_ORDER, "FreeTDS CEL Backend",
        .load = load_module,
        .unload = unload_module,
        .reload = reload,
+       .load_pri = AST_MODPRI_CDR_DRIVER,
 );