[asterisk-commits] russell: branch russell/cdr-q r254000 - in /team/russell/cdr-q: cdr/ include/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 23 13:43:39 CDT 2010


Author: russell
Date: Tue Mar 23 13:43:35 2010
New Revision: 254000

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=254000
Log:
Address comments from mmichelson's review

Modified:
    team/russell/cdr-q/cdr/cdr_adaptive_odbc.c
    team/russell/cdr-q/cdr/cdr_custom.c
    team/russell/cdr-q/cdr/cdr_syslog.c
    team/russell/cdr-q/include/asterisk/cdr.h
    team/russell/cdr-q/main/cdr.c

Modified: team/russell/cdr-q/cdr/cdr_adaptive_odbc.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/cdr-q/cdr/cdr_adaptive_odbc.c?view=diff&rev=254000&r1=253999&r2=254000
==============================================================================
--- team/russell/cdr-q/cdr/cdr_adaptive_odbc.c (original)
+++ team/russell/cdr-q/cdr/cdr_adaptive_odbc.c Tue Mar 23 13:43:35 2010
@@ -164,6 +164,12 @@
 
 		tableptr->backend = ast_cdr_register_sink(name, ast_module_info->description,
 					tableptr->table, sink_cb, tableptr);
+		if (!tableptr->backend) {
+			ast_odbc_release_obj(obj);
+			ast_free(tableptr);
+			res = -1;
+			break;
+		}
 
 		ast_verb(3, "Found adaptive CDR table %s@%s.\n", tableptr->table, tableptr->connection);
 
@@ -278,8 +284,7 @@
 {
 	struct columns *entry;
 
-	ast_cdr_unregister_sink(table->backend);
-	table->backend = NULL;
+	table->backend = ast_cdr_unregister_sink(table->backend);
 
 	while ((entry = AST_LIST_REMOVE_HEAD(&(table->columns), list))) {
 		ast_free(entry);

Modified: team/russell/cdr-q/cdr/cdr_custom.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/cdr-q/cdr/cdr_custom.c?view=diff&rev=254000&r1=253999&r2=254000
==============================================================================
--- team/russell/cdr-q/cdr/cdr_custom.c (original)
+++ team/russell/cdr-q/cdr/cdr_custom.c Tue Mar 23 13:43:35 2010
@@ -69,8 +69,7 @@
 
 static void cdr_config_destroy(struct cdr_config *sink)
 {
-	ast_cdr_unregister_sink(sink->backend);
-	sink->backend = NULL;
+	sink->backend = ast_cdr_unregister_sink(sink->backend);
 
 	ast_mutex_destroy(&sink->lock);
 
@@ -126,6 +125,10 @@
 
 		sink->backend = ast_cdr_register_sink(name, ast_module_info->description, sink->filename,
 					cdr_sink_cb, sink);
+		if (!sink->backend) {
+			cdr_config_destroy(sink);
+			continue;
+		}
 
 		AST_RWLIST_INSERT_TAIL(&sinks, sink, list);
 	}

Modified: team/russell/cdr-q/cdr/cdr_syslog.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/cdr-q/cdr/cdr_syslog.c?view=diff&rev=254000&r1=253999&r2=254000
==============================================================================
--- team/russell/cdr-q/cdr/cdr_syslog.c (original)
+++ team/russell/cdr-q/cdr/cdr_syslog.c Tue Mar 23 13:43:35 2010
@@ -66,8 +66,7 @@
 
 static void destroy_cdr_config(struct cdr_config *sink)
 {
-	ast_cdr_unregister_sink(sink->backend);
-	sink->backend = NULL;
+	sink->backend = ast_cdr_unregister_sink(sink->backend);
 
 	ast_mutex_destroy(&sink->lock);
 
@@ -201,6 +200,10 @@
 
 		sink->backend = ast_cdr_register_sink(name, ast_module_info->description,
 					sink->ident, sink_cb, sink);
+		if (!sink->backend) {
+			destroy_cdr_config(sink);
+			continue;
+		}
 
 		if (ast_strlen_zero(tmp = ast_variable_retrieve(cfg, catg, "facility"))) {
 			sink->facility = default_facility;

Modified: team/russell/cdr-q/include/asterisk/cdr.h
URL: http://svnview.digium.com/svn/asterisk/team/russell/cdr-q/include/asterisk/cdr.h?view=diff&rev=254000&r1=253999&r2=254000
==============================================================================
--- team/russell/cdr-q/include/asterisk/cdr.h (original)
+++ team/russell/cdr-q/include/asterisk/cdr.h Tue Mar 23 13:43:35 2010
@@ -205,10 +205,9 @@
  *
  * \param backend The reference returned from ast_cdr_register_sink().
  *
- * \retval 0 success
- * \retval -1 failure
- */
-int ast_cdr_unregister_sink(struct ast_cdr_backend *backend);
+ * \return NULL
+ */
+struct ast_cdr_backend *ast_cdr_unregister_sink(struct ast_cdr_backend *backend);
 
 /*!
  * \brief CDR backend callback

Modified: team/russell/cdr-q/main/cdr.c
URL: http://svnview.digium.com/svn/asterisk/team/russell/cdr-q/main/cdr.c?view=diff&rev=254000&r1=253999&r2=254000
==============================================================================
--- team/russell/cdr-q/main/cdr.c (original)
+++ team/russell/cdr-q/main/cdr.c Tue Mar 23 13:43:35 2010
@@ -370,18 +370,18 @@
 			name, desc, unique_id);
 }
 
-int ast_cdr_unregister_sink(struct ast_cdr_backend *backend)
+struct ast_cdr_backend *ast_cdr_unregister_sink(struct ast_cdr_backend *backend)
 {
 	backend = ao2_find(cdr_backends, backend, OBJ_POINTER | OBJ_UNLINK);
 
 	if (!backend) {
 		ast_log(LOG_ERROR, "CDR backend not found\n");
-		return -1;
+		return NULL;
 	}
 
 	ao2_t_ref(backend, -1, "unregistered CDR sink");
 
-	return 0;
+	return NULL;
 }
 
 int ast_cdr_register(const char *name, const char *desc, ast_cdr_post_cb post_cb)




More information about the asterisk-commits mailing list