From 081e38483ec55dcfca3d92434fe94f0777ed962d Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 3 Aug 2006 20:07:35 +0000 Subject: 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. --- networking/httpd.c | 2 +- networking/traceroute.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'networking') diff --git a/networking/httpd.c b/networking/httpd.c index 4e0ab92..8852cbb 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -1929,7 +1929,7 @@ int httpd_main(int argc, char *argv[]) USE_FEATURE_HTTPD_AUTH_MD5(const char *pass;) - config = xcalloc(1, sizeof(*config)); + config = xzalloc(sizeof(*config)); #ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH config->realm = "Web Server Authentication"; #endif diff --git a/networking/traceroute.c b/networking/traceroute.c index 4464903..9c1d634 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) -- cgit v1.1