diff options
author | Rob Landley <rob@landley.net> | 2006-08-04 00:07:35 +0400 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2006-08-04 00:07:35 +0400 |
commit | 081e38483ec55dcfca3d92434fe94f0777ed962d (patch) | |
tree | 2d31e921a759c769f339055c9946205fabef5cbf /networking/traceroute.c | |
parent | 86b4d64aa3f5ca4c2824a8948541b0e18dfe0a74 (diff) |
Remove xcalloc() and convert its callers to xzalloc(). About half of them
were using "1" as one of the arguments anyway, and as for the rest a multiply
and a push isn't noticeably bigger than pushing two arguments on the stack.
Diffstat (limited to 'networking/traceroute.c')
-rw-r--r-- | networking/traceroute.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/traceroute.c b/networking/traceroute.c index 446490303..9c1d6346e 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -375,7 +375,7 @@ ifaddrlist(struct IFADDRLIST **ipaddrp) ifend = (struct ifreq *)((char *)ibuf + ifc.ifc_len); nipaddr = 1 + (ifc.ifc_len / sizeof(struct ifreq)); - st_ifaddrlist = xcalloc(nipaddr, sizeof(struct IFADDRLIST)); + st_ifaddrlist = xzalloc(nipaddr * sizeof(struct IFADDRLIST)); al = st_ifaddrlist; nipaddr = 0; @@ -872,12 +872,12 @@ gethostinfo(const char *host) char **p; u_int32_t addr, *ap; - hi = xcalloc(1, sizeof(*hi)); + hi = xzalloc(sizeof(*hi)); addr = inet_addr(host); if ((int32_t)addr != -1) { hi->name = xstrdup(host); hi->n = 1; - hi->addrs = xcalloc(1, sizeof(hi->addrs[0])); + hi->addrs = xzalloc(sizeof(hi->addrs[0])); hi->addrs[0] = addr; return hi; } @@ -889,7 +889,7 @@ gethostinfo(const char *host) for (n = 0, p = hp->h_addr_list; *p != NULL; ++n, ++p) continue; hi->n = n; - hi->addrs = xcalloc(n, sizeof(hi->addrs[0])); + hi->addrs = xzalloc(n * sizeof(hi->addrs[0])); for (ap = hi->addrs, p = hp->h_addr_list; *p != NULL; ++ap, ++p) memcpy(ap, *p, sizeof(*ap)); return hi; @@ -1161,7 +1161,7 @@ traceroute_main(int argc, char *argv[]) xsetgid(getgid()); xsetuid(getuid()); - outip = (struct ip *)xcalloc(1, (unsigned)packlen); + outip = (struct ip *)xzalloc(packlen); outip->ip_v = IPVERSION; if (tos_str) |