[Freeswitch-svn] [commit] r6695 - in freeswitch/trunk/src/mod/applications: mod_dptools mod_expr mod_fifo mod_limit

Freeswitch SVN mikej at freeswitch.org
Tue Dec 11 22:21:14 EST 2007


Author: mikej
Date: Tue Dec 11 22:21:14 2007
New Revision: 6695

Modified:
   freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
   freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
   freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
   freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c

Log:
cleanup, null checks. etc.

Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c	Tue Dec 11 22:21:14 2007
@@ -456,7 +456,7 @@
 		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No variable name specified.\n");
 	} else {
 		var = strdup(data);
-		assert(var);
+		switch_assert(var);
 		val = strchr(var, '=');
 
 		if (val) {

Modified: freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_expr/mod_expr.c	Tue Dec 11 22:21:14 2007
@@ -61,7 +61,7 @@
 
 
     m_cmd = malloc(len);
-    assert(m_cmd);
+    switch_assert(m_cmd);
     switch_copy_string(m_cmd, cmd, len);
     
     for (p = m_cmd; p && *p; p++) {

Modified: freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_fifo/mod_fifo.c	Tue Dec 11 22:21:14 2007
@@ -124,7 +124,7 @@
     }
 
     mydata = switch_core_session_strdup(session, data);
-    assert(mydata);
+    switch_assert(mydata);
     if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 2) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "USAGE %s\n", FIFO_USAGE);
         return;
@@ -137,7 +137,7 @@
         switch_queue_create(&node->fifo, SWITCH_CORE_QUEUE_LEN, globals.pool);
         switch_core_hash_init(&node->caller_hash, globals.pool);
         switch_core_hash_init(&node->consumer_hash, globals.pool);
-        assert(node->fifo);
+        switch_assert(node->fifo);
         switch_mutex_init(&node->mutex, SWITCH_MUTEX_NESTED, globals.pool);
         switch_core_hash_insert(globals.fifo_hash, argv[0], node);
     }
@@ -337,12 +337,12 @@
 
                 switch_channel_answer(channel);
 				cloned_profile = switch_caller_profile_clone(other_session, switch_channel_get_caller_profile(channel));
-                assert(cloned_profile);
+                switch_assert(cloned_profile);
                 switch_channel_set_originator_caller_profile(other_channel, cloned_profile);
 
 				cloned_profile = switch_caller_profile_clone(session, switch_channel_get_caller_profile(other_channel));
-                assert(cloned_profile);
-                assert(cloned_profile->next == NULL);
+                switch_assert(cloned_profile);
+                switch_assert(cloned_profile->next == NULL);
                 switch_channel_set_originatee_caller_profile(channel, cloned_profile);
 				
                 ts = switch_timestamp_now();
@@ -414,7 +414,7 @@
     const void *var;
 
     x_tmp = switch_xml_add_child_d(xml, container, cc_off++);
-    assert(x_tmp);
+    switch_assert(x_tmp);
 
     for (hi = switch_hash_first(NULL, hash); hi; hi = switch_hash_next(hi)) {
         int c_off = 0, d_off = 0;
@@ -425,7 +425,7 @@
         session = (switch_core_session_t *) val;
         channel = switch_core_session_get_channel(session);
         x_caller = switch_xml_add_child_d(x_tmp, tag, c_off++);
-        assert(x_caller);
+        switch_assert(x_caller);
         
         switch_xml_set_attr_d(x_caller, "uuid", switch_core_session_get_uuid(session));
 
@@ -468,7 +468,7 @@
 	char *tmp = buffer;
 
     x_fifo = switch_xml_add_child_d(x_report, "fifo", (*off)++);;
-    assert(x_fifo);
+    switch_assert(x_fifo);
 
     switch_xml_set_attr_d(x_fifo, "name", node->name);
     snprintf(tmp, sizeof(buffer), "%d", node->consumer_count);
@@ -496,10 +496,10 @@
 
     if (!switch_strlen_zero(cmd)) {
         data = strdup(cmd);
-        assert(data);
+        switch_assert(data);
     }
     
-    if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1) {
+    if (switch_strlen_zero(cmd) || (argc = switch_separate_string(data, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) < 1 || !argv[0]) {
         stream->write_function(stream, "%s\n", FIFO_API_SYNTAX);
         return SWITCH_STATUS_SUCCESS;
     }
@@ -510,7 +510,7 @@
     if (!strcasecmp(argv[0], "list") || verbose) {    
         char *xml_text = NULL;
         switch_xml_t x_report = switch_xml_new("fifo_report");
-        assert(x_report);
+        switch_assert(x_report);
 
         if (argc < 2) {
             for (hi = switch_hash_first(NULL, globals.fifo_hash); hi; hi = switch_hash_next(hi)) {
@@ -528,7 +528,7 @@
             }
         }
         xml_text = switch_xml_toxml(x_report, SWITCH_FALSE);
-        assert(xml_text);
+        switch_assert(xml_text);
         stream->write_function(stream, "%s\n", xml_text);
         switch_xml_free(x_report);
         switch_safe_free(xml_text);

Modified: freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c	(original)
+++ freeswitch/trunk/src/mod/applications/mod_limit/mod_limit.c	Tue Dec 11 22:21:14 2007
@@ -345,7 +345,7 @@
         argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
     }
 
-    if (argc < 1) {
+    if (argc < 1 || !argv[0]) {
         goto error;
     }
 
@@ -419,7 +419,7 @@
         argc = switch_separate_string(mydata, '/', argv, (sizeof(argv) / sizeof(argv[0])));
     }
 
-    if (argc < 4) {
+    if (argc < 4 || !argv[0]) {
         goto error;
     }
     
@@ -460,7 +460,7 @@
         argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
     }
 
-    if (argc < 2) {
+    if (argc < 2 || !argv[0]) {
         goto error;
     }
 
@@ -544,7 +544,7 @@
         argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])));
     }
 
-    if (argc < 3) {
+    if (argc < 3 || !argv[0]) {
         switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "USAGE: group %s\n", DB_USAGE);
         return;
     }



More information about the Freeswitch-svn mailing list