From c14bdacc17b291354d257ec3a65101ff19eda7bc Mon Sep 17 00:00:00 2001 From: yamt Date: Sat, 29 Oct 2005 12:26:37 +0000 Subject: [PATCH] MALLOC/FREE -> malloc/free where appropriate. --- sys/kern/bufq_disksort.c | 8 ++++---- sys/kern/bufq_fcfs.c | 7 +++---- sys/kern/bufq_readprio.c | 7 +++---- sys/kern/kern_sysctl.c | 36 +++++++++++++++++------------------- 4 files changed, 27 insertions(+), 31 deletions(-) diff --git a/sys/kern/bufq_disksort.c b/sys/kern/bufq_disksort.c index acbdec2a6047..cccf41465e3b 100644 --- a/sys/kern/bufq_disksort.c +++ b/sys/kern/bufq_disksort.c @@ -1,4 +1,4 @@ -/* $NetBSD: bufq_disksort.c,v 1.4 2005/10/15 17:29:26 yamt Exp $ */ +/* $NetBSD: bufq_disksort.c,v 1.5 2005/10/29 12:26:37 yamt Exp $ */ /* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */ /*- @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bufq_disksort.c,v 1.4 2005/10/15 17:29:26 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bufq_disksort.c,v 1.5 2005/10/29 12:26:37 yamt Exp $"); #include #include @@ -205,8 +205,8 @@ bufq_disksort_init(struct bufq_state *bufq) bufq->bq_get = bufq_disksort_get; bufq->bq_put = bufq_disksort_put; - MALLOC(bufq->bq_private, struct bufq_disksort *, - sizeof(struct bufq_disksort), M_DEVBUF, M_ZERO); + bufq->bq_private = malloc(sizeof(struct bufq_disksort), + M_DEVBUF, M_ZERO); disksort = (struct bufq_disksort *)bufq->bq_private; TAILQ_INIT(&disksort->bq_head); } diff --git a/sys/kern/bufq_fcfs.c b/sys/kern/bufq_fcfs.c index d93c08c23671..255c2b69dcc0 100644 --- a/sys/kern/bufq_fcfs.c +++ b/sys/kern/bufq_fcfs.c @@ -1,4 +1,4 @@ -/* $NetBSD: bufq_fcfs.c,v 1.4 2005/10/15 17:29:26 yamt Exp $ */ +/* $NetBSD: bufq_fcfs.c,v 1.5 2005/10/29 12:26:37 yamt Exp $ */ /* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */ /*- @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bufq_fcfs.c,v 1.4 2005/10/15 17:29:26 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bufq_fcfs.c,v 1.5 2005/10/29 12:26:37 yamt Exp $"); #include #include @@ -129,8 +129,7 @@ bufq_fcfs_init(struct bufq_state *bufq) bufq->bq_get = bufq_fcfs_get; bufq->bq_put = bufq_fcfs_put; - MALLOC(bufq->bq_private, struct bufq_fcfs *, - sizeof(struct bufq_fcfs), M_DEVBUF, M_ZERO); + bufq->bq_private = malloc(sizeof(struct bufq_fcfs), M_DEVBUF, M_ZERO); fcfs = (struct bufq_fcfs *)bufq->bq_private; TAILQ_INIT(&fcfs->bq_head); } diff --git a/sys/kern/bufq_readprio.c b/sys/kern/bufq_readprio.c index f6c6e6e56a56..ed3d96417db6 100644 --- a/sys/kern/bufq_readprio.c +++ b/sys/kern/bufq_readprio.c @@ -1,4 +1,4 @@ -/* $NetBSD: bufq_readprio.c,v 1.5 2005/10/15 19:57:24 xtraeme Exp $ */ +/* $NetBSD: bufq_readprio.c,v 1.6 2005/10/29 12:26:37 yamt Exp $ */ /* NetBSD: subr_disk.c,v 1.61 2004/09/25 03:30:44 thorpej Exp */ /*- @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bufq_readprio.c,v 1.5 2005/10/15 19:57:24 xtraeme Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bufq_readprio.c,v 1.6 2005/10/29 12:26:37 yamt Exp $"); #include #include @@ -226,8 +226,7 @@ bufq_readprio_init(struct bufq_state *bufq) bufq->bq_get = bufq_prio_get; bufq->bq_put = bufq_prio_put; - MALLOC(bufq->bq_private, struct bufq_prio *, - sizeof(struct bufq_prio), M_DEVBUF, M_ZERO); + bufq->bq_private = malloc(sizeof(struct bufq_prio), M_DEVBUF, M_ZERO); prio = (struct bufq_prio *)bufq->bq_private; TAILQ_INIT(&prio->bq_read); TAILQ_INIT(&prio->bq_write); diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c index 9bc37154ec76..6b019f340468 100644 --- a/sys/kern/kern_sysctl.c +++ b/sys/kern/kern_sysctl.c @@ -1,4 +1,4 @@ -/* $NetBSD: kern_sysctl.c,v 1.186 2005/08/21 13:14:54 yamt Exp $ */ +/* $NetBSD: kern_sysctl.c,v 1.187 2005/10/29 12:26:37 yamt Exp $ */ /*- * Copyright (c) 2003 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.186 2005/08/21 13:14:54 yamt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_sysctl.c,v 1.187 2005/10/29 12:26:37 yamt Exp $"); #include "opt_defcorename.h" #include "opt_insecure.h" @@ -996,7 +996,7 @@ sysctl_create(SYSCTLFN_ARGS) error = sysctl_copyin(l, nnode.sysctl_data, own, sz); if (error != 0) { - FREE(own, M_SYSCTLDATA); + free(own, M_SYSCTLDATA); return (error); } } @@ -1321,13 +1321,13 @@ sysctl_destroy(SYSCTLFN_ARGS) */ if (node->sysctl_flags & CTLFLAG_OWNDATA) { if (node->sysctl_data != NULL) - FREE(node->sysctl_data, M_SYSCTLDATA); + free(node->sysctl_data, M_SYSCTLDATA); node->sysctl_data = NULL; } if (node->sysctl_flags & CTLFLAG_OWNDESC) { if (node->sysctl_desc != NULL) /*XXXUNCONST*/ - FREE(__UNCONST(node->sysctl_desc), M_SYSCTLDATA); + free(__UNCONST(node->sysctl_desc), M_SYSCTLDATA); node->sysctl_desc = NULL; } @@ -1366,7 +1366,7 @@ sysctl_destroy(SYSCTLFN_ARGS) * if this parent just lost its last child, nuke the creche */ if (pnode->sysctl_clen == 0) { - FREE(pnode->sysctl_child, M_SYSCTLNODE); + free(pnode->sysctl_child, M_SYSCTLNODE); pnode->sysctl_csize = 0; pnode->sysctl_child = NULL; } @@ -1529,7 +1529,7 @@ sysctl_lookup(SYSCTLFN_ARGS) return (ENOMEM); error = sysctl_copyin(l, newp, newbuf, len); if (error) { - FREE(newbuf, M_SYSCTLDATA); + free(newbuf, M_SYSCTLDATA); return (error); } @@ -1538,7 +1538,7 @@ sysctl_lookup(SYSCTLFN_ARGS) * left to do it ourselves? */ if (newbuf[len - 1] != '\0' && len == sz) { - FREE(newbuf, M_SYSCTLDATA); + free(newbuf, M_SYSCTLDATA); return (EINVAL); } @@ -1549,7 +1549,7 @@ sysctl_lookup(SYSCTLFN_ARGS) memcpy(rnode->sysctl_data, newbuf, len); if (sz != len) memset((char*)rnode->sysctl_data + len, 0, sz - len); - FREE(newbuf, M_SYSCTLDATA); + free(newbuf, M_SYSCTLDATA); break; } default: @@ -2365,7 +2365,7 @@ sysctl_free(struct sysctlnode *rnode) if (SYSCTL_FLAGS(node->sysctl_flags) & CTLFLAG_OWNDATA) { if (node->sysctl_data != NULL) { - FREE(node->sysctl_data, + free(node->sysctl_data, M_SYSCTLDATA); node->sysctl_data = NULL; } @@ -2374,7 +2374,7 @@ sysctl_free(struct sysctlnode *rnode) CTLFLAG_OWNDESC) { if (node->sysctl_desc != NULL) { /*XXXUNCONST*/ - FREE(__UNCONST(node->sysctl_desc), + free(__UNCONST(node->sysctl_desc), M_SYSCTLDATA); node->sysctl_desc = NULL; } @@ -2389,7 +2389,7 @@ sysctl_free(struct sysctlnode *rnode) break; } if (pnode->sysctl_child != NULL) - FREE(pnode->sysctl_child, M_SYSCTLNODE); + free(pnode->sysctl_child, M_SYSCTLNODE); pnode->sysctl_clen = 0; pnode->sysctl_csize = 0; pnode->sysctl_child = NULL; @@ -2412,13 +2412,13 @@ sysctl_log_add(struct sysctllog **logp, const struct sysctlnode *node) return (0); if (*logp == NULL) { - MALLOC(log, struct sysctllog *, sizeof(struct sysctllog), + log = malloc(sizeof(struct sysctllog), M_SYSCTLDATA, M_WAITOK|M_CANFAIL); if (log == NULL) { /* XXX print error message? */ return (-1); } - MALLOC(log->log_num, int *, 16 * sizeof(int), + log->log_num = malloc(16 * sizeof(int), M_SYSCTLDATA, M_WAITOK|M_CANFAIL); if (log->log_num == NULL) { /* XXX print error message? */ @@ -2643,12 +2643,10 @@ sysctl_alloc(struct sysctlnode *p, int x) assert(p->sysctl_child == NULL); if (x == 1) - MALLOC(n, struct sysctlnode *, - sizeof(struct sysctlnode), + n = malloc(sizeof(struct sysctlnode), M_SYSCTLNODE, M_WAITOK|M_CANFAIL); else - MALLOC(n, struct sysctlnode *, - SYSCTL_DEFSIZE * sizeof(struct sysctlnode), + n = malloc(SYSCTL_DEFSIZE * sizeof(struct sysctlnode), M_SYSCTLNODE, M_WAITOK|M_CANFAIL); if (n == NULL) return (ENOMEM); @@ -2710,7 +2708,7 @@ sysctl_realloc(struct sysctlnode *p) /* * get out with the old and in with the new */ - FREE(p->sysctl_child, M_SYSCTLNODE); + free(p->sysctl_child, M_SYSCTLNODE); p->sysctl_child = n; return (0);