Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys Change the queue.3 *_END(&head) macros to NULL. Since we...
details: https://anonhg.NetBSD.org/src/rev/ff19810a87b3
branches: trunk
changeset: 791645:ff19810a87b3
user: christos <christos%NetBSD.org@localhost>
date: Wed Nov 27 17:24:43 2013 +0000
description:
Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
diffstat:
sys/arch/amiga/amiga/cc.c | 48 +++++++++++++--------------
sys/arch/atari/atari/stalloc.c | 39 ++++++++++-------------
sys/arch/hpc/hpc/config_hook.c | 14 ++++----
sys/coda/coda_vfsops.c | 5 +-
sys/compat/common/vfs_syscalls_20.c | 7 +--
sys/compat/netbsd32/netbsd32_compat_20.c | 6 +-
sys/compat/osf1/osf1_mount.c | 6 +-
sys/compat/ultrix/ultrix_fs.c | 8 ++--
sys/fs/nfs/server/nfs_nfsdcache.c | 10 ++--
sys/fs/nfs/server/nfs_nfsdstate.c | 54 ++++++++++++++++----------------
sys/kern/kern_verifiedexec.c | 10 ++---
sys/kern/vfs_subr.c | 10 ++---
sys/kern/vfs_syscalls.c | 10 ++---
sys/miscfs/procfs/procfs_linux.c | 7 +--
sys/ufs/lfs/lfs_bio.c | 7 +--
sys/ufs/lfs/lfs_vfsops.c | 7 +--
16 files changed, 115 insertions(+), 133 deletions(-)
diffs (truncated from 942 to 300 lines):
diff -r c39598920c22 -r ff19810a87b3 sys/arch/amiga/amiga/cc.c
--- a/sys/arch/amiga/amiga/cc.c Wed Nov 27 16:36:54 2013 +0000
+++ b/sys/arch/amiga/amiga/cc.c Wed Nov 27 17:24:43 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cc.c,v 1.23 2013/11/23 22:48:00 christos Exp $ */
+/* $NetBSD: cc.c,v 1.24 2013/11/27 17:24:43 christos Exp $ */
/*
* Copyright (c) 1994 Christian E. Hopps
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.23 2013/11/23 22:48:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.24 2013/11/27 17:24:43 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -90,22 +90,22 @@
struct vbl_node *n, *prev;
s = spl3();
- prev = LIST_END(&vbl_list);
+ prev = NULL;
LIST_FOREACH(n, &vbl_list, link) {
if (add->priority > n->priority) {
/* insert add_node before. */
- if (prev == LIST_END(&vbl_list)) {
+ if (prev == NULL) {
LIST_INSERT_HEAD(&vbl_list, add, link);
} else {
LIST_INSERT_AFTER(prev, add, link);
}
- add = LIST_END(&vbl_list);
+ add = NULL;
break;
}
prev = n;
}
- if (add != LIST_END(&vbl_list)) {
- if (prev == LIST_END(&vbl_list)) {
+ if (add != NULL) {
+ if (prev == NULL) {
LIST_INSERT_HEAD(&vbl_list, add, link);
} else {
LIST_INSERT_AFTER(prev, add, link);
@@ -136,7 +136,7 @@
n->flags |= VBLNF_OFF;
n->flags &= ~(VBLNF_TURNOFF);
} else {
- if (n != LIST_END(&vbl_list))
+ if (n != NULL)
n->function(n->data);
}
}
@@ -504,7 +504,7 @@
if (size <= mn->size)
break;
- if (mn == TAILQ_END(&free_list))
+ if (mn == NULL)
return NULL;
if ((mn->size - size) <= sizeof (*mn)) {
@@ -513,7 +513,7 @@
* for a new node in between.
*/
TAILQ_REMOVE(&free_list, mn, free_link);
- TAILQ_NEXT(mn, free_link) = TAILQ_END(&free_list);
+ TAILQ_NEXT(mn, free_link) = NULL;
size = mn->size; /* increase size. (or same) */
chip_total -= mn->size;
splx(s);
@@ -533,7 +533,7 @@
* and mark as not on free list
*/
TAILQ_INSERT_AFTER(&chip_list, new, mn, link);
- TAILQ_NEXT(mn, free_link) = TAILQ_END(&free_list);
+ TAILQ_NEXT(mn, free_link) = NULL;
chip_total -= size + sizeof(struct mem_node);
splx(s);
@@ -557,8 +557,8 @@
/*
* check ahead of us.
*/
- if (TAILQ_NEXT(next, link) != TAILQ_END(&chip_list) &&
- TAILQ_NEXT(next, free_link) != TAILQ_END(&free_list)) {
+ if (TAILQ_NEXT(next, link) != NULL &&
+ TAILQ_NEXT(next, free_link) != NULL) {
/*
* if next is: a valid node and a free node. ==> merge
*/
@@ -568,12 +568,12 @@
chip_total += mn->size + sizeof(struct mem_node);
mn->size += next->size + sizeof(struct mem_node);
}
- if (TAILQ_PREV(prev, chiplist, link) != TAILQ_END(&chip_list) &&
- TAILQ_PREV(prev, freelist, free_link) != TAILQ_END(&free_list)) {
+ if (TAILQ_PREV(prev, chiplist, link) != NULL &&
+ TAILQ_PREV(prev, freelist, free_link) != NULL) {
/*
* if prev is: a valid node and a free node. ==> merge
*/
- if (TAILQ_NEXT(mn, free_link) == TAILQ_END(&free_list))
+ if (TAILQ_NEXT(mn, free_link) == NULL)
chip_total += mn->size + sizeof(struct mem_node);
else {
/* already on free list */
@@ -582,20 +582,18 @@
}
TAILQ_REMOVE(&chip_list, mn, link);
prev->size += mn->size + sizeof(struct mem_node);
- } else if (TAILQ_NEXT(mn, free_link) == TAILQ_END(&free_list)) {
+ } else if (TAILQ_NEXT(mn, free_link) == NULL) {
/*
* we still are not on free list and we need to be.
* <-- | -->
*/
- while (TAILQ_NEXT(next, link) != TAILQ_END(&chip_list) &&
- TAILQ_PREV(prev, chiplist, link) != TAILQ_END(&chip_list)) {
- if (TAILQ_NEXT(next, free_link) !=
- TAILQ_END(&free_list)) {
+ while (TAILQ_NEXT(next, link) != NULL &&
+ TAILQ_PREV(prev, chiplist, link) != NULL) {
+ if (TAILQ_NEXT(next, free_link) != NULL) {
TAILQ_INSERT_BEFORE(next, mn, free_link);
break;
}
- if (TAILQ_NEXT(prev, free_link) !=
- TAILQ_END(&free_list)) {
+ if (TAILQ_NEXT(prev, free_link) != NULL) {
TAILQ_INSERT_AFTER(&free_list, prev, mn,
free_link);
break;
@@ -603,8 +601,8 @@
prev = TAILQ_PREV(prev, chiplist, link);
next = TAILQ_NEXT(next, link);
}
- if (TAILQ_NEXT(mn, free_link) == TAILQ_END(&free_list)) {
- if (TAILQ_NEXT(next, link) == TAILQ_END(&chip_list)) {
+ if (TAILQ_NEXT(mn, free_link) == NULL) {
+ if (TAILQ_NEXT(next, link) == NULL) {
/*
* we are not on list so we can add
* ourselves to the tail. (we walked to it.)
diff -r c39598920c22 -r ff19810a87b3 sys/arch/atari/atari/stalloc.c
--- a/sys/arch/atari/atari/stalloc.c Wed Nov 27 16:36:54 2013 +0000
+++ b/sys/arch/atari/atari/stalloc.c Wed Nov 27 17:24:43 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: stalloc.c,v 1.14 2013/11/23 22:52:40 christos Exp $ */
+/* $NetBSD: stalloc.c,v 1.15 2013/11/27 17:24:43 christos Exp $ */
/*
* Copyright (c) 1995 Leo Weppelman (Atari modifications)
@@ -34,7 +34,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.14 2013/11/23 22:52:40 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: stalloc.c,v 1.15 2013/11/27 17:24:43 christos Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -93,18 +93,18 @@
/*
* walk list of available nodes, finding the best-fit.
*/
- bfit = TAILQ_END(&free_list);
+ bfit = NULL;
TAILQ_FOREACH(mn, &free_list, free_link) {
if (size <= mn->size) {
- if ((bfit != TAILQ_END(&free_list)) &&
+ if ((bfit != NULL) &&
(bfit->size < mn->size))
continue;
bfit = mn;
}
}
- if (bfit != TAILQ_END(&free_list))
+ if (bfit != NULL)
mn = bfit;
- if (mn == TAILQ_END(&free_list)) {
+ if (mn == NULL) {
printf("St-mem pool exhausted, binpatch 'st_pool_size'"
"to get more\n");
splx(s);
@@ -117,7 +117,7 @@
* for a new node in between.
*/
TAILQ_REMOVE(&free_list, mn, free_link);
- TAILQ_NEXT(mn, free_link) = TAILQ_END(&free_list);
+ TAILQ_NEXT(mn, free_link) = NULL;
size = mn->size; /* increase size. (or same) */
stmem_total -= mn->size;
splx(s);
@@ -138,7 +138,7 @@
* and mark as not on free list
*/
TAILQ_INSERT_AFTER(&st_list, new, mn, link);
- TAILQ_NEXT(mn, free_link) = TAILQ_END(&free_list);
+ TAILQ_NEXT(mn, free_link) = NULL;
stmem_total -= size + sizeof(struct mem_node);
splx(s);
@@ -163,8 +163,7 @@
/*
* check ahead of us.
*/
- if (next != LIST_END(&st_list) &&
- TAILQ_NEXT(next, free_link) != TAILQ_END(&free_list)) {
+ if (next != NULL && TAILQ_NEXT(next, free_link) != NULL) {
/*
* if next is: a valid node and a free node. ==> merge
*/
@@ -174,12 +173,11 @@
stmem_total += mn->size + sizeof(struct mem_node);
mn->size += next->size + sizeof(struct mem_node);
}
- if (prev != LIST_END(&st_list) &&
- TAILQ_PREV(prev, freelist, free_link) != TAILQ_END(&free_list)) {
+ if (prev != NULL && TAILQ_PREV(prev, freelist, free_link) != NULL) {
/*
* if prev is: a valid node and a free node. ==> merge
*/
- if (TAILQ_NEXT(mn, free_link) == TAILQ_END(&free_list))
+ if (TAILQ_NEXT(mn, free_link) == NULL)
stmem_total += mn->size + sizeof(struct mem_node);
else {
/* already on free list */
@@ -188,20 +186,17 @@
}
TAILQ_REMOVE(&st_list, mn, link);
prev->size += mn->size + sizeof(struct mem_node);
- } else if (TAILQ_NEXT(mn, free_link) == TAILQ_END(&free_list)) {
+ } else if (TAILQ_NEXT(mn, free_link) == NULL) {
/*
* we still are not on free list and we need to be.
* <-- | -->
*/
- while (next != LIST_END(&st_list) &&
- prev != LIST_END(&st_list)) {
- if (TAILQ_NEXT(next, free_link) !=
- TAILQ_END(&free_list)) {
+ while (next != NULL && prev != NULL) {
+ if (TAILQ_NEXT(next, free_link) != NULL) {
TAILQ_INSERT_BEFORE(next, mn, free_link);
break;
}
- if (TAILQ_NEXT(prev, free_link) !=
- TAILQ_END(&free_list)) {
+ if (TAILQ_NEXT(prev, free_link) != NULL) {
TAILQ_INSERT_AFTER(&free_list, prev, mn,
free_link);
break;
@@ -209,8 +204,8 @@
prev = TAILQ_PREV(prev, stlist, link);
next = TAILQ_NEXT(next, link);
}
- if (TAILQ_NEXT(mn, free_link) == TAILQ_END(&free_list)) {
- if (next == LIST_END(&st_list)) {
+ if (TAILQ_NEXT(mn, free_link) == NULL) {
+ if (next == NULL) {
/*
* we are not on list so we can add
* ourselves to the tail. (we walked to it.)
diff -r c39598920c22 -r ff19810a87b3 sys/arch/hpc/hpc/config_hook.c
--- a/sys/arch/hpc/hpc/config_hook.c Wed Nov 27 16:36:54 2013 +0000
+++ b/sys/arch/hpc/hpc/config_hook.c Wed Nov 27 17:24:43 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: config_hook.c,v 1.9 2013/11/23 22:31:53 christos Exp $ */
+/* $NetBSD: config_hook.c,v 1.10 2013/11/27 17:24:43 christos Exp $ */
/*-
* Copyright (c) 1999-2001
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: config_hook.c,v 1.9 2013/11/23 22:31:53 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: config_hook.c,v 1.10 2013/11/27 17:24:43 christos Exp $");
#include <sys/param.h>
#include <sys/device.h>
@@ -103,8 +103,7 @@
type, id);
s = splhigh();
TAILQ_REMOVE(&hook_lists[type], prev_hr, hr_link);
- TAILQ_NEXT(prev_hr, hr_link) =
- TAILQ_END(&hook_lists[type]);
+ TAILQ_NEXT(prev_hr, hr_link) = NULL;
splx(s);
}
break;
@@ -157,10 +156,10 @@
int s;
struct hook_rec *hr = (struct hook_rec*)hrx, *cr;
- if (TAILQ_NEXT(hr, hr_link) != TAILQ_END(&hook_lists[hr->hr_type])) {
+ if (TAILQ_NEXT(hr, hr_link) != NULL) {
Home |
Main Index |
Thread Index |
Old Index