add missing parenthesis in macros, detected by lint and debugged by todd.
This commit is contained in:
parent
a3fad63f23
commit
6685080692
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: malloc.h,v 1.60 2001/04/30 01:13:21 lukem Exp $ */
|
||||
/* $NetBSD: malloc.h,v 1.61 2001/05/11 05:13:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
|
@ -382,16 +382,16 @@ struct kmembuckets {
|
|||
#if defined(KMEMSTATS) || defined(DIAGNOSTIC) || defined(_LKM) || \
|
||||
defined(MALLOCLOG) || defined(LOCKDEBUG)
|
||||
#define MALLOC(space, cast, size, type, flags) \
|
||||
(space) = (cast)malloc((u_long)(size), type, flags)
|
||||
#define FREE(addr, type) free((caddr_t)(addr), type)
|
||||
(space) = (cast)malloc((u_long)(size), (type), (flags))
|
||||
#define FREE(addr, type) free((caddr_t)(addr), (type))
|
||||
|
||||
#else /* do not collect statistics */
|
||||
#define MALLOC(space, cast, size, type, flags) \
|
||||
do { \
|
||||
register struct kmembuckets *kbp = &bucket[BUCKETINDX(size)]; \
|
||||
register struct kmembuckets *kbp = &bucket[BUCKETINDX((size))]; \
|
||||
long s = splvm(); \
|
||||
if (kbp->kb_next == NULL) { \
|
||||
(space) = (cast)malloc((u_long)(size), type, flags); \
|
||||
(space) = (cast)malloc((u_long)(size), (type), (flags)); \
|
||||
} else { \
|
||||
(space) = (cast)kbp->kb_next; \
|
||||
kbp->kb_next = *(caddr_t *)(space); \
|
||||
|
@ -402,10 +402,10 @@ do { \
|
|||
#define FREE(addr, type) \
|
||||
do { \
|
||||
register struct kmembuckets *kbp; \
|
||||
register struct kmemusage *kup = btokup(addr); \
|
||||
register struct kmemusage *kup = btokup((addr)); \
|
||||
long s = splvm(); \
|
||||
if (1 << kup->ku_indx > MAXALLOCSAVE) { \
|
||||
free((caddr_t)(addr), type); \
|
||||
free((caddr_t)(addr), (type)); \
|
||||
} else { \
|
||||
kbp = &bucket[kup->ku_indx]; \
|
||||
if (kbp->kb_next == NULL) \
|
||||
|
@ -416,7 +416,7 @@ do { \
|
|||
kbp->kb_last = (caddr_t)(addr); \
|
||||
} \
|
||||
splx(s); \
|
||||
} while(0)
|
||||
} while(/* CONSTCOND */ 0)
|
||||
#endif /* do not collect statistics */
|
||||
|
||||
extern struct kmemstats kmemstats[];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: queue.h,v 1.26 2000/11/19 06:00:57 chs Exp $ */
|
||||
/* $NetBSD: queue.h,v 1.27 2001/05/11 05:13:57 lukem Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1991, 1993
|
||||
|
@ -113,9 +113,9 @@ struct { \
|
|||
if ((elm)->field.le_next && \
|
||||
(elm)->field.le_next->field.le_prev != \
|
||||
&(elm)->field.le_next) \
|
||||
panic("LIST_* forw %p", elm); \
|
||||
panic("LIST_* forw %p", (elm)); \
|
||||
if (*(elm)->field.le_prev != (elm)) \
|
||||
panic("LIST_* back %p", elm);
|
||||
panic("LIST_* back %p", (elm));
|
||||
#else
|
||||
#define QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field)
|
||||
#define QUEUEDEBUG_LIST_OP(elm, field)
|
||||
|
@ -126,7 +126,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_AFTER(listelm, elm, field) do { \
|
||||
QUEUEDEBUG_LIST_OP(listelm, field) \
|
||||
QUEUEDEBUG_LIST_OP((listelm), (field)) \
|
||||
if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \
|
||||
(listelm)->field.le_next->field.le_prev = \
|
||||
&(elm)->field.le_next; \
|
||||
|
@ -135,7 +135,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
QUEUEDEBUG_LIST_OP(listelm, field) \
|
||||
QUEUEDEBUG_LIST_OP((listelm), (field)) \
|
||||
(elm)->field.le_prev = (listelm)->field.le_prev; \
|
||||
(elm)->field.le_next = (listelm); \
|
||||
*(listelm)->field.le_prev = (elm); \
|
||||
|
@ -143,7 +143,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_INSERT_HEAD(head, elm, field) do { \
|
||||
QUEUEDEBUG_LIST_INSERT_HEAD(head, elm, field) \
|
||||
QUEUEDEBUG_LIST_INSERT_HEAD((head), (elm), (field)) \
|
||||
if (((elm)->field.le_next = (head)->lh_first) != NULL) \
|
||||
(head)->lh_first->field.le_prev = &(elm)->field.le_next;\
|
||||
(head)->lh_first = (elm); \
|
||||
|
@ -151,7 +151,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define LIST_REMOVE(elm, field) do { \
|
||||
QUEUEDEBUG_LIST_OP(elm, field) \
|
||||
QUEUEDEBUG_LIST_OP((elm), (field)) \
|
||||
if ((elm)->field.le_next != NULL) \
|
||||
(elm)->field.le_next->field.le_prev = \
|
||||
(elm)->field.le_prev; \
|
||||
|
@ -322,9 +322,9 @@ struct { \
|
|||
if ((elm)->field.tqe_next && \
|
||||
(elm)->field.tqe_next->field.tqe_prev != \
|
||||
&(elm)->field.tqe_next) \
|
||||
panic("TAILQ_* forw %p", elm); \
|
||||
panic("TAILQ_* forw %p", (elm)); \
|
||||
if (*(elm)->field.tqe_prev != (elm)) \
|
||||
panic("TAILQ_* back %p", elm);
|
||||
panic("TAILQ_* back %p", (elm));
|
||||
#else
|
||||
#define QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field)
|
||||
#define QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field)
|
||||
|
@ -337,7 +337,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_INSERT_HEAD(head, elm, field) \
|
||||
QUEUEDEBUG_TAILQ_INSERT_HEAD((head), (elm), (field)) \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
|
@ -348,7 +348,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_INSERT_TAIL(head, elm, field) \
|
||||
QUEUEDEBUG_TAILQ_INSERT_TAIL((head), (elm), (field)) \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
|
@ -356,7 +356,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_OP(listelm, field) \
|
||||
QUEUEDEBUG_TAILQ_OP((listelm), (field)) \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
|
@ -367,7 +367,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_OP(listelm, field) \
|
||||
QUEUEDEBUG_TAILQ_OP((listelm), (field)) \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
|
@ -375,7 +375,7 @@ struct { \
|
|||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
QUEUEDEBUG_TAILQ_OP(elm, field) \
|
||||
QUEUEDEBUG_TAILQ_OP((elm), (field)) \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
|
|
Loading…
Reference in New Issue