[asterisk-commits] seanbright: trunk r123076 - /trunk/cdr/cdr_tds.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jun 16 12:33:10 CDT 2008


Author: seanbright
Date: Mon Jun 16 12:33:10 2008
New Revision: 123076

URL: http://svn.digium.com/view/asterisk?view=rev&rev=123076
Log:
Last commit for a bit, minor cleanups and move the lock initialization.

Modified:
    trunk/cdr/cdr_tds.c

Modified: trunk/cdr/cdr_tds.c
URL: http://svn.digium.com/view/asterisk/trunk/cdr/cdr_tds.c?view=diff&rev=123076&r1=123075&r2=123076
==============================================================================
--- trunk/cdr/cdr_tds.c (original)
+++ trunk/cdr/cdr_tds.c Mon Jun 16 12:33:10 2008
@@ -108,6 +108,8 @@
 
 static int mssql_connect(void);
 static int mssql_disconnect(void);
+
+static void cdr_tds_config_destroy(void);
 
 static int tds_log(struct ast_cdr *cdr)
 {
@@ -395,15 +397,20 @@
 	return -1;
 }
 
-static int tds_unload_module(void)
-{
-	mssql_disconnect();
-
-	ast_cdr_unregister(name);
-
+static void cdr_tds_config_destroy(void)
+{
 	ast_mutex_destroy(&settings->lock);
 	ast_string_field_free_memory(settings);
-	ast_free(settings);
+	ast_free(settings);	
+}
+
+static int tds_unload_module(void)
+{
+	mssql_disconnect();
+
+	ast_cdr_unregister(name);
+
+	cdr_tds_config_destroy();
 
 	return 0;
 }
@@ -417,7 +424,7 @@
 
 	cfg = ast_config_load(config, config_flags);
 	if (!cfg) {
-		ast_log(LOG_NOTICE, "Unable to load config for MSSQL CDR's: %s\n", config);
+		ast_log(LOG_NOTICE, "Unable to load config for MSSQL CDRs: %s\n", config);
 		return 0;
 	} else if (cfg == CONFIG_STATUS_FILEUNCHANGED)
 		return 0;
@@ -441,9 +448,9 @@
 			ast_config_destroy(cfg);
 			return 0;
 		}
-	}
-
-	ast_mutex_init(&settings->lock);
+
+		ast_mutex_init(&settings->lock);
+	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "hostname");
 	if (ptr) {
@@ -470,7 +477,7 @@
 	if (ptr) {
 		ast_string_field_set(settings, password, ptr);
 	} else {
-		ast_log(LOG_ERROR,"Database password not specified.\n");
+		ast_log(LOG_ERROR, "Database password not specified.\n");
 	}
 
 	ptr = ast_variable_retrieve(cfg, "global", "charset");




More information about the asterisk-commits mailing list