]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Move variables down into loop where they're used
authorTravis Cross <tc@traviscross.com>
Wed, 9 Apr 2014 07:11:15 +0000 (07:11 +0000)
committerTravis Cross <tc@traviscross.com>
Sat, 19 Apr 2014 01:49:24 +0000 (01:49 +0000)
These variables aren't used outside of this for loop, so they should
be declared within it.

src/switch_ivr_play_say.c

index 3313b8c714f18da402b03b7b4173a020fc7ed5b8..64f154747b9983e63d1cd57fcabd01427fdd0896 100644 (file)
@@ -202,10 +202,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
                if (pattern) {
                        switch_regex_t *re = NULL;
                        int proceed = 0, ovector[100];
-                       char *substituted = NULL;
-                       uint32_t len = 0;
-                       char *odata = NULL;
-                       char *expanded = NULL;
                        switch_xml_t match = NULL;
 
                        status = SWITCH_STATUS_SUCCESS;
@@ -221,6 +217,10 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
                                for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; action = action->next) {
                                        char *adata = (char *) switch_xml_attr_soft(action, "data");
                                        char *func = (char *) switch_xml_attr_soft(action, "function");
+                                       char *substituted = NULL;
+                                       uint32_t len = 0;
+                                       char *odata = NULL;
+                                       char *expanded = NULL;
 
                                        if (strchr(pattern, '(') && strchr(adata, '$') && proceed > 0) {
                                                len = (uint32_t) (strlen(data) + strlen(adata) + 10) * proceed;