]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
Move some variable declarations to a more correct place
authorAndrew Thompson <andrew@hijacked.us>
Tue, 10 Mar 2009 19:06:19 +0000 (19:06 +0000)
committerAndrew Thompson <andrew@hijacked.us>
Tue, 10 Mar 2009 19:06:19 +0000 (19:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12549 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/event_handlers/mod_erlang_event/mod_erlang_event.c

index 8aad698c5751a9359eaa9aa8e5298702abc2d669..fc9ca55bed5b1656ad12903f6af6dd3f6320bb22 100644 (file)
@@ -353,6 +353,11 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
        struct erlang_binding *ptr;
        switch_uuid_t uuid;
        char uuid_str[SWITCH_UUID_FORMATTED_LENGTH+1];
+       int type, size;
+       int i = 0;
+       void *p = NULL;
+       char *xmlstr;
+       ei_x_buff *rep;
        ei_x_buff buf;
        ei_x_new_with_version(&buf);
 
@@ -394,10 +399,6 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
        ei_sendto(ptr->listener->ec, ptr->listener->sockfd, &ptr->process, &buf);
        switch_mutex_unlock(ptr->listener->sock_mutex);
 
-       int i = 0;
-       ei_x_buff *rep;
-       void *p = NULL;
-
        while (!(p = switch_core_hash_find(ptr->listener->fetch_reply_hash, uuid_str)) || p == &globals.WAITING) {
                if (i > 50) { /* half a second timeout */
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Timed out when waiting for XML fetch response\n");
@@ -409,14 +410,12 @@ static switch_xml_t erlang_fetch(const char *sectionstr, const char *tag_name, c
        }
 
        rep = (ei_x_buff *) p;
-       int type, size;
 
        ei_get_type(rep->buff, &rep->index, &type, &size);
 
        if (type != ERL_STRING_EXT && type != ERL_BINARY_EXT) /* XXX no unicode or character codes > 255 */
                return NULL;
 
-       char *xmlstr;
        
        if (!(xmlstr = malloc(size + 1))) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error\n");