Mercurial > pidgin.yaz
changeset 32253:c4859b6b1d74
Fix formatting by a third grader with a crayon
author | Ethan Blanton <elb@pidgin.im> |
---|---|
date | Mon, 15 Aug 2011 04:18:59 +0000 |
parents | 9ceccb623544 |
children | 22cb8c11bba8 |
files | libpurple/nat-pmp.c |
diffstat | 1 files changed, 20 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/nat-pmp.c Mon Aug 15 04:16:23 2011 +0000 +++ b/libpurple/nat-pmp.c Mon Aug 15 04:18:59 2011 +0000 @@ -177,43 +177,43 @@ default_gw() { int mib[6]; - size_t needed; - char *buf, *next, *lim; - struct rt_msghdr *rtm; - struct sockaddr *sa; + size_t needed; + char *buf, *next, *lim; + struct rt_msghdr *rtm; + struct sockaddr *sa; struct sockaddr_in *sin = NULL; - mib[0] = CTL_NET; - mib[1] = PF_ROUTE; /* entire routing table or a subset of it */ - mib[2] = 0; /* protocol number - always 0 */ - mib[3] = 0; /* address family - 0 for all addres families */ - mib[4] = NET_RT_DUMP; - mib[5] = 0; + mib[0] = CTL_NET; + mib[1] = PF_ROUTE; /* entire routing table or a subset of it */ + mib[2] = 0; /* protocol number - always 0 */ + mib[3] = 0; /* address family - 0 for all addres families */ + mib[4] = NET_RT_DUMP; + mib[5] = 0; /* Determine the buffer side needed to get the full routing table */ - if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) + if (sysctl(mib, 6, NULL, &needed, NULL, 0) < 0) { purple_debug_warning("nat-pmp", "sysctl: net.route.0.0.dump estimate\n"); return NULL; - } + } - if (!(buf = malloc(needed))) + if (!(buf = malloc(needed))) { purple_debug_warning("nat-pmp", "Failed to malloc %" G_GSIZE_FORMAT "\n", needed); return NULL; - } + } /* Read the routing table into buf */ - if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) + if (sysctl(mib, 6, buf, &needed, NULL, 0) < 0) { free(buf); purple_debug_warning("nat-pmp", "sysctl: net.route.0.0.dump\n"); return NULL; - } + } - lim = buf + needed; + lim = buf + needed; - for (next = buf; next < lim; next += rtm->rtm_msglen) + for (next = buf; next < lim; next += rtm->rtm_msglen) { rtm = (struct rt_msghdr *)next; sa = (struct sockaddr *)(rtm + 1); @@ -226,7 +226,7 @@ && cursin->sin_addr.s_addr == INADDR_ANY) { /* We found the default route. Now get the destination address and netmask. */ - struct sockaddr *rti_info[RTAX_MAX]; + struct sockaddr *rti_info[RTAX_MAX]; struct sockaddr addr, mask; get_rtaddrs(rtm->rtm_addrs, sa, rti_info); @@ -257,7 +257,7 @@ } } } - } + } free(buf); return sin;