summaryrefslogtreecommitdiffstats
path: root/sys/net
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
committerdes <des@FreeBSD.org>2008-10-23 15:53:51 +0000
commit66f807ed8b3634dc73d9f7526c484e43f094c0ee (patch)
tree21e792ce590e1bcf9b343890605a1b4c6a9016b3 /sys/net
parenta779c60ce0a41cd14710a8a12cfa22955108b27a (diff)
downloadFreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.zip
FreeBSD-src-66f807ed8b3634dc73d9f7526c484e43f094c0ee.tar.gz
Retire the MALLOC and FREE macros. They are an abomination unto style(9).
MFC after: 3 months
Diffstat (limited to 'sys/net')
-rw-r--r--sys/net/bpf.c2
-rw-r--r--sys/net/bsd_comp.c4
-rw-r--r--sys/net/if.c22
-rw-r--r--sys/net/if_arcsubr.c4
-rw-r--r--sys/net/if_ethersubr.c4
-rw-r--r--sys/net/if_fddisubr.c4
-rw-r--r--sys/net/if_iso88025subr.c4
-rw-r--r--sys/net/if_ppp.c4
-rw-r--r--sys/net/if_sl.c7
-rw-r--r--sys/net/if_tap.c2
-rw-r--r--sys/net/if_tun.c2
-rw-r--r--sys/net/ppp_deflate.c6
-rw-r--r--sys/net/rtsock.c2
13 files changed, 33 insertions, 34 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c
index da5a98f..6eb58f7 100644
--- a/sys/net/bpf.c
+++ b/sys/net/bpf.c
@@ -619,7 +619,7 @@ bpfopen(struct cdev *dev, int flags, int fmt, struct thread *td)
struct bpf_d *d;
int error;
- MALLOC(d, struct bpf_d *, sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
+ d = malloc(sizeof(*d), M_BPF, M_WAITOK | M_ZERO);
error = devfs_set_cdevpriv(d, bpf_dtor);
if (error != 0) {
free(d, M_BPF);
diff --git a/sys/net/bsd_comp.c b/sys/net/bsd_comp.c
index 3506196..462567b 100644
--- a/sys/net/bsd_comp.c
+++ b/sys/net/bsd_comp.c
@@ -346,7 +346,7 @@ bsd_alloc(options, opt_len, decomp)
maxmaxcode = MAXCODE(bits);
newlen = sizeof(*db) + (hsize-1) * (sizeof(db->dict[0]));
- MALLOC(db, struct bsd_db *, newlen, M_DEVBUF, M_NOWAIT);
+ db = malloc(newlen, M_DEVBUF, M_NOWAIT);
if (!db)
return NULL;
bzero(db, sizeof(*db) - sizeof(db->dict));
@@ -354,7 +354,7 @@ bsd_alloc(options, opt_len, decomp)
if (!decomp) {
db->lens = NULL;
} else {
- MALLOC(db->lens, u_int16_t *, (maxmaxcode+1) * sizeof(db->lens[0]),
+ db->lens = malloc((maxmaxcode+1) * sizeof(db->lens[0]),
M_DEVBUF, M_NOWAIT);
if (!db->lens) {
free(db, M_DEVBUF);
diff --git a/sys/net/if.c b/sys/net/if.c
index 7bf1ecb..e8e00e0 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -2299,14 +2299,14 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa,
struct ifmultiaddr *ifma;
struct sockaddr *dupsa;
- MALLOC(ifma, struct ifmultiaddr *, sizeof *ifma, M_IFMADDR, mflags |
+ ifma = malloc(sizeof *ifma, M_IFMADDR, mflags |
M_ZERO);
if (ifma == NULL)
return (NULL);
- MALLOC(dupsa, struct sockaddr *, sa->sa_len, M_IFMADDR, mflags);
+ dupsa = malloc(sa->sa_len, M_IFMADDR, mflags);
if (dupsa == NULL) {
- FREE(ifma, M_IFMADDR);
+ free(ifma, M_IFMADDR);
return (NULL);
}
bcopy(sa, dupsa, sa->sa_len);
@@ -2321,10 +2321,10 @@ if_allocmulti(struct ifnet *ifp, struct sockaddr *sa, struct sockaddr *llsa,
return (ifma);
}
- MALLOC(dupsa, struct sockaddr *, llsa->sa_len, M_IFMADDR, mflags);
+ dupsa = malloc(llsa->sa_len, M_IFMADDR, mflags);
if (dupsa == NULL) {
- FREE(ifma->ifma_addr, M_IFMADDR);
- FREE(ifma, M_IFMADDR);
+ free(ifma->ifma_addr, M_IFMADDR);
+ free(ifma, M_IFMADDR);
return (NULL);
}
bcopy(llsa, dupsa, llsa->sa_len);
@@ -2349,9 +2349,9 @@ if_freemulti(struct ifmultiaddr *ifma)
("if_freemulti: protospec not NULL"));
if (ifma->ifma_lladdr != NULL)
- FREE(ifma->ifma_lladdr, M_IFMADDR);
- FREE(ifma->ifma_addr, M_IFMADDR);
- FREE(ifma, M_IFMADDR);
+ free(ifma->ifma_lladdr, M_IFMADDR);
+ free(ifma->ifma_addr, M_IFMADDR);
+ free(ifma, M_IFMADDR);
}
/*
@@ -2469,13 +2469,13 @@ if_addmulti(struct ifnet *ifp, struct sockaddr *sa,
}
if (llsa != NULL)
- FREE(llsa, M_IFMADDR);
+ free(llsa, M_IFMADDR);
return (0);
free_llsa_out:
if (llsa != NULL)
- FREE(llsa, M_IFMADDR);
+ free(llsa, M_IFMADDR);
unlock_out:
IF_ADDR_UNLOCK(ifp);
diff --git a/sys/net/if_arcsubr.c b/sys/net/if_arcsubr.c
index 30fb47e..578549e 100644
--- a/sys/net/if_arcsubr.c
+++ b/sys/net/if_arcsubr.c
@@ -778,7 +778,7 @@ arc_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return EADDRNOTAVAIL;
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return ENOMEM;
@@ -806,7 +806,7 @@ arc_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
}
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return EADDRNOTAVAIL;
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return ENOMEM;
diff --git a/sys/net/if_ethersubr.c b/sys/net/if_ethersubr.c
index c51b331..0365d1b 100644
--- a/sys/net/if_ethersubr.c
+++ b/sys/net/if_ethersubr.c
@@ -1124,7 +1124,7 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return EADDRNOTAVAIL;
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return ENOMEM;
@@ -1153,7 +1153,7 @@ ether_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
}
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return EADDRNOTAVAIL;
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return (ENOMEM);
diff --git a/sys/net/if_fddisubr.c b/sys/net/if_fddisubr.c
index c4e7b62..a8eab74 100644
--- a/sys/net/if_fddisubr.c
+++ b/sys/net/if_fddisubr.c
@@ -718,7 +718,7 @@ fddi_resolvemulti(ifp, llsa, sa)
sin = (struct sockaddr_in *)sa;
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
return (EADDRNOTAVAIL);
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return (ENOMEM);
@@ -749,7 +749,7 @@ fddi_resolvemulti(ifp, llsa, sa)
}
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
return (EADDRNOTAVAIL);
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT | M_ZERO);
if (sdl == NULL)
return (ENOMEM);
diff --git a/sys/net/if_iso88025subr.c b/sys/net/if_iso88025subr.c
index dd50923..0c915c9 100644
--- a/sys/net/if_iso88025subr.c
+++ b/sys/net/if_iso88025subr.c
@@ -720,7 +720,7 @@ iso88025_resolvemulti (ifp, llsa, sa)
if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr))) {
return (EADDRNOTAVAIL);
}
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return (ENOMEM);
@@ -750,7 +750,7 @@ iso88025_resolvemulti (ifp, llsa, sa)
if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr)) {
return (EADDRNOTAVAIL);
}
- MALLOC(sdl, struct sockaddr_dl *, sizeof *sdl, M_IFMADDR,
+ sdl = malloc(sizeof *sdl, M_IFMADDR,
M_NOWAIT|M_ZERO);
if (sdl == NULL)
return (ENOMEM);
diff --git a/sys/net/if_ppp.c b/sys/net/if_ppp.c
index a24cd81..753adf9 100644
--- a/sys/net/if_ppp.c
+++ b/sys/net/if_ppp.c
@@ -348,7 +348,7 @@ pppalloc(pid)
sc->sc_relinq = NULL;
bzero((char *)&sc->sc_stats, sizeof(sc->sc_stats));
#ifdef VJC
- MALLOC(sc->sc_comp, struct slcompress *, sizeof(struct slcompress),
+ sc->sc_comp = malloc(sizeof(struct slcompress),
M_DEVBUF, M_NOWAIT);
if (sc->sc_comp)
sl_compress_init(sc->sc_comp, -1);
@@ -614,7 +614,7 @@ pppioctl(sc, cmd, data, flag, td)
}
newcodelen = nbp->bf_len * sizeof(struct bpf_insn);
if (newcodelen != 0) {
- MALLOC(newcode, struct bpf_insn *, newcodelen, M_DEVBUF, M_WAITOK);
+ newcode = malloc(newcodelen, M_DEVBUF, M_WAITOK);
if (newcode == 0) {
error = EINVAL; /* or sumpin */
break;
diff --git a/sys/net/if_sl.c b/sys/net/if_sl.c
index 801d3a7..f5bf533 100644
--- a/sys/net/if_sl.c
+++ b/sys/net/if_sl.c
@@ -271,7 +271,7 @@ slmarkstatic(int unit)
if (slisstatic(unit))
return;
- MALLOC(t, int *, sizeof(int) * (st_unit_max+1), M_SL, M_NOWAIT);
+ t = malloc(sizeof(int) * (st_unit_max+1), M_SL, M_NOWAIT);
if (t == NULL)
return;
@@ -291,7 +291,7 @@ slcreate(void)
int unit;
struct mbuf *m;
- MALLOC(sc, struct sl_softc *, sizeof(*sc), M_SL, M_WAITOK | M_ZERO);
+ sc = malloc(sizeof(*sc), M_SL, M_WAITOK | M_ZERO);
sc->sc_ifp = if_alloc(IFT_SLIP);
if (sc->sc_ifp == NULL) {
free(sc, M_SL);
@@ -664,8 +664,7 @@ sltstart(struct tty *tp)
register u_char *cp;
if (sc->bpfbuf == NULL)
- MALLOC(sc->bpfbuf, u_char *,
- SLTMAX + SLIP_HDRLEN, M_SL, M_NOWAIT);
+ sc->bpfbuf = malloc( SLTMAX + SLIP_HDRLEN, M_SL, M_NOWAIT);
if (sc->bpfbuf) {
cp = sc->bpfbuf + SLIP_HDRLEN;
diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c
index 6dfc8c9..b4ee7e1 100644
--- a/sys/net/if_tap.c
+++ b/sys/net/if_tap.c
@@ -412,7 +412,7 @@ tapcreate(struct cdev *dev)
dev->si_flags &= ~SI_CHEAPCLONE;
/* allocate driver storage and create device */
- MALLOC(tp, struct tap_softc *, sizeof(*tp), M_TAP, M_WAITOK | M_ZERO);
+ tp = malloc(sizeof(*tp), M_TAP, M_WAITOK | M_ZERO);
mtx_init(&tp->tap_mtx, "tap_mtx", NULL, MTX_DEF);
mtx_lock(&tapmtx);
SLIST_INSERT_HEAD(&taphead, tp, tap_next);
diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c
index a1ec495..50006f0 100644
--- a/sys/net/if_tun.c
+++ b/sys/net/if_tun.c
@@ -363,7 +363,7 @@ tuncreate(const char *name, struct cdev *dev)
dev->si_flags &= ~SI_CHEAPCLONE;
- MALLOC(sc, struct tun_softc *, sizeof(*sc), M_TUN, M_WAITOK | M_ZERO);
+ sc = malloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO);
mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF);
sc->tun_flags = TUN_INITED;
sc->tun_dev = dev;
diff --git a/sys/net/ppp_deflate.c b/sys/net/ppp_deflate.c
index 0bf0c49..e3015bd 100644
--- a/sys/net/ppp_deflate.c
+++ b/sys/net/ppp_deflate.c
@@ -126,7 +126,7 @@ z_alloc(notused, items, size)
{
void *ptr;
- MALLOC(ptr, void *, items * size, M_DEVBUF, M_NOWAIT);
+ ptr = malloc(items * size, M_DEVBUF, M_NOWAIT);
return ptr;
}
@@ -159,7 +159,7 @@ z_comp_alloc(options, opt_len)
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL;
- MALLOC(state, struct deflate_state *, sizeof(struct deflate_state),
+ state = malloc(sizeof(struct deflate_state),
M_DEVBUF, M_NOWAIT);
if (state == NULL)
return NULL;
@@ -389,7 +389,7 @@ z_decomp_alloc(options, opt_len)
if (w_size < DEFLATE_MIN_SIZE || w_size > DEFLATE_MAX_SIZE)
return NULL;
- MALLOC(state, struct deflate_state *, sizeof(struct deflate_state),
+ state = malloc(sizeof(struct deflate_state),
M_DEVBUF, M_NOWAIT);
if (state == NULL)
return NULL;
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 7b610d6..ae6fa6a 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -169,7 +169,7 @@ rts_attach(struct socket *so, int proto, struct thread *td)
KASSERT(so->so_pcb == NULL, ("rts_attach: so_pcb != NULL"));
/* XXX */
- MALLOC(rp, struct rawcb *, sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
+ rp = malloc(sizeof *rp, M_PCB, M_WAITOK | M_ZERO);
if (rp == NULL)
return ENOBUFS;
OpenPOWER on IntegriCloud