]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
cleanup, null checks. etc.
authorMichael Jerris <mike@jerris.com>
Wed, 12 Dec 2007 03:21:14 +0000 (03:21 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 12 Dec 2007 03:21:14 +0000 (03:21 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6695 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_dptools/mod_dptools.c
src/mod/applications/mod_expr/mod_expr.c
src/mod/applications/mod_fifo/mod_fifo.c
src/mod/applications/mod_limit/mod_limit.c

index ff444c44bd9604d78b53a47d724606e57061325c..c745b0a4533bc076413d1f4a962d918417aaf67b 100644 (file)
@@ -456,7 +456,7 @@ SWITCH_STANDARD_APP(set_global_function)
                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) {
index addb2fd7da82c94a363e78c2105011fb6749cc82..b04dc85057f2fb96e53e0c0bbd78a85b4193d1a2 100644 (file)
@@ -61,7 +61,7 @@ SWITCH_STANDARD_API(expr_function)
 
 
     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++) {
index 2d3e5567c310e2cd1beec9cdb7dc1e6177f2270d..671aa0c127b45973d0841c4303a227ebf18b387c 100644 (file)
@@ -124,7 +124,7 @@ SWITCH_STANDARD_APP(fifo_function)
     }
 
     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_STANDARD_APP(fifo_function)
         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_STANDARD_APP(fifo_function)
 
                 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 @@ static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char
     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 @@ static int xml_hash(switch_xml_t xml, switch_hash_t *hash, char *container, char
         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 @@ static void list_node(fifo_node_t *node, switch_xml_t x_report, int *off, int ve
        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 @@ SWITCH_STANDARD_API(fifo_api_function)
 
     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 @@ SWITCH_STANDARD_API(fifo_api_function)
     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 @@ SWITCH_STANDARD_API(fifo_api_function)
             }
         }
         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);
index 3af7d0f49b20c8a31854ab401cb4cf15d3c5fa36..faddd53e0dc92b5ea02e9e7ffbed1cbe94f2ef08 100644 (file)
@@ -345,7 +345,7 @@ SWITCH_STANDARD_API(db_api_function)
         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 @@ SWITCH_STANDARD_APP(db_function)
         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 @@ SWITCH_STANDARD_API(group_api_function)
         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 @@ SWITCH_STANDARD_APP(group_function)
         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;
     }