提交 34ff6ab9 authored 作者: Leon de Rooij's avatar Leon de Rooij

Removed unnecessary if() and modified some comments


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk/contrib@14859 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 caf5a4e5
......@@ -136,20 +136,18 @@ static switch_status_t do_config(switch_bool_t reload)
/* make odbc connection */
if (!reload) {
if (switch_odbc_available() && globals.odbc_dsn) {
if (!(globals.odbc_handle = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
goto done;
}
if (switch_odbc_handle_connect(globals.odbc_handle) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
goto done;
}
if (!(globals.odbc_handle = switch_odbc_handle_new(globals.odbc_dsn, odbc_user, odbc_pass))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
goto done;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: [%s]\n", globals.odbc_dsn);
if (switch_odbc_handle_connect(globals.odbc_handle) != SWITCH_ODBC_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Cannot Open ODBC Database!\n");
goto done;
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Connected ODBC DSN: [%s]\n", globals.odbc_dsn);
}
status = SWITCH_STATUS_SUCCESS;
......@@ -210,7 +208,6 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_odbc_query_load)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "ODBC Query module loading...\n");
/* allocate the queries hash */
//if (switch_core_hash_init(&globals->queries_hash, globals.pool) != SWITCH_STATUS_SUCCESS) {
if (switch_core_hash_init(&globals.queries_hash, globals.pool) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error initializing the queries hash\n");
return SWITCH_STATUS_GENERR;
......@@ -218,7 +215,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_odbc_query_load)
if (do_config(SWITCH_FALSE) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to load xml_odbc config file\n");
/* TODO what about freeing queries_hash and pool here ? */
/* TODO what about freeing queries_hash here ? */
return SWITCH_STATUS_FALSE;
}
......@@ -228,7 +225,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_odbc_query_load)
/* subscribe to reloadxml event, and hook it to reload_event_handler */
if ((switch_event_bind_removable(modname, SWITCH_EVENT_RELOADXML, NULL, reload_event_handler, NULL, &NODE) != SWITCH_STATUS_SUCCESS)) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind event!\n");
/* TODO what about freeing queries_hash and pool here ? */
/* TODO what about freeing queries_hash here ? */
return SWITCH_STATUS_TERM;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论