[asterisk-commits] trunk r29264 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Sun May 21 17:07:49 MST 2006
Author: rizzo
Date: Sun May 21 19:07:48 2006
New Revision: 29264
URL: http://svn.digium.com/view/asterisk?rev=29264&view=rev
Log:
simplify logic in realtime_peer(), removing an unnecessary
initialization, an extra variable (newpeername) and a
variable newpeername, and an 'else' branch.
Modified:
trunk/channels/chan_sip.c
Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=29264&r1=29263&r2=29264&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Sun May 21 19:07:48 2006
@@ -2027,25 +2027,23 @@
* \todo Consider adding check of port address when matching here to follow the same
* algorithm as for static peers. Will we break anything by adding that?
*/
-static struct sip_peer *realtime_peer(const char *peername, struct sockaddr_in *sin)
-{
- struct sip_peer *peer = NULL;
- struct ast_variable *var;
+static struct sip_peer *realtime_peer(const char *newpeername, struct sockaddr_in *sin)
+{
+ struct sip_peer *peer;
+ struct ast_variable *var = NULL;
struct ast_variable *tmp;
- char *newpeername = (char *) peername;
char iabuf[80];
/* First check on peer name */
if (newpeername)
- var = ast_load_realtime("sippeers", "name", peername, NULL);
+ var = ast_load_realtime("sippeers", "name", newpeername, NULL);
else if (sin) { /* Then check on IP address for dynamic peers */
ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr);
var = ast_load_realtime("sippeers", "host", iabuf, NULL); /* First check for fixed IP hosts */
if (!var)
var = ast_load_realtime("sippeers", "ipaddr", iabuf, NULL); /* Then check for registred hosts */
- } else
- return NULL;
+ }
if (!var)
return NULL;
More information about the asterisk-commits
mailing list