Cleaning up code
authorOlle Johansson <oej@edvina.net>
Tue, 31 Oct 2006 13:51:30 +0000 (13:51 +0000)
committerOlle Johansson <oej@edvina.net>
Tue, 31 Oct 2006 13:51:30 +0000 (13:51 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@46649 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_sip.c

index 5a23324..8bd3834 100644 (file)
@@ -2740,33 +2740,33 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer)
 {
        struct hostent *hp;
        struct ast_hostent ahp;
-       struct sip_peer *p;
+       struct sip_peer *peer;
        char *port;
        int portno;
        char host[MAXHOSTNAMELEN], *hostn;
-       char peer[256];
+       char peername[256];
 
-       ast_copy_string(peer, opeer, sizeof(peer));
-       port = strchr(peer, ':');
+       ast_copy_string(peername, opeer, sizeof(peername));
+       port = strchr(peername, ':');
        if (port)
                *port++ = '\0';
        dialog->sa.sin_family = AF_INET;
        dialog->timer_t1 = 500; /* Default SIP retransmission timer T1 (RFC 3261) */
-       p = find_peer(peer, NULL, 1);
+       peer = find_peer(peername, NULL, 1);
 
-       if (p) {
-               int res = create_addr_from_peer(dialog, p);
-               ASTOBJ_UNREF(p, sip_destroy_peer);
+       if (peer) {
+               int res = create_addr_from_peer(dialog, peer);
+               ASTOBJ_UNREF(peer, sip_destroy_peer);
                return res;
        }
-       hostn = peer;
+       hostn = peername;
        portno = port ? atoi(port) : STANDARD_SIP_PORT;
        if (srvlookup) {
                char service[MAXHOSTNAMELEN];
                int tportno;
                int ret;
 
-               snprintf(service, sizeof(service), "_sip._udp.%s", peer);
+               snprintf(service, sizeof(service), "_sip._udp.%s", peername);
                ret = ast_get_srv(NULL, host, sizeof(host), &tportno, service);
                if (ret > 0) {
                        hostn = host;
@@ -2775,10 +2775,10 @@ static int create_addr(struct sip_pvt *dialog, const char *opeer)
        }
        hp = ast_gethostbyname(hostn, &ahp);
        if (!hp) {
-               ast_log(LOG_WARNING, "No such host: %s\n", peer);
+               ast_log(LOG_WARNING, "No such host: %s\n", peername);
                return -1;
        }
-       ast_string_field_set(dialog, tohost, peer);
+       ast_string_field_set(dialog, tohost, peername);
        memcpy(&dialog->sa.sin_addr, hp->h_addr, sizeof(dialog->sa.sin_addr));
        dialog->sa.sin_port = htons(portno);
        dialog->recv = dialog->sa;