Use macro TAILQ_FOREACH_SAFE instead of expanding it.

This commit is contained in:
David Xu 2006-10-22 00:09:41 +00:00
parent f71e748d89
commit 5c28a8d474
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=163601

View File

@ -276,8 +276,7 @@ sigqueue_get(sigqueue_t *sq, int signo, ksiginfo_t *si)
SIGDELSET(sq->sq_kill, signo);
}
for (ksi = TAILQ_FIRST(&sq->sq_list); ksi != NULL; ksi = next) {
next = TAILQ_NEXT(ksi, ksi_link);
TAILQ_FOREACH_SAFE(ksi, &sq->sq_list, ksi_link, next) {
if (ksi->ksi_signo == signo) {
if (count == 0) {
TAILQ_REMOVE(&sq->sq_list, ksi, ksi_link);
@ -428,8 +427,7 @@ sigqueue_move_set(sigqueue_t *src, sigqueue_t *dst, sigset_t *setp)
p1 = src->sq_proc;
p2 = dst->sq_proc;
/* Move siginfo to target list */
for (ksi = TAILQ_FIRST(&src->sq_list); ksi != NULL; ksi = next) {
next = TAILQ_NEXT(ksi, ksi_link);
TAILQ_FOREACH_SAFE(ksi, &src->sq_list, ksi_link, next) {
if (SIGISMEMBER(set, ksi->ksi_signo)) {
TAILQ_REMOVE(&src->sq_list, ksi, ksi_link);
if (p1 != NULL)
@ -475,8 +473,7 @@ sigqueue_delete_set(sigqueue_t *sq, sigset_t *set)
KASSERT(sq->sq_flags & SQ_INIT, ("src sigqueue not inited"));
/* Remove siginfo queue */
for (ksi = TAILQ_FIRST(&sq->sq_list); ksi != NULL; ksi = next) {
next = TAILQ_NEXT(ksi, ksi_link);
TAILQ_FOREACH_SAFE(ksi, &sq->sq_list, ksi_link, next) {
if (SIGISMEMBER(*set, ksi->ksi_signo)) {
TAILQ_REMOVE(&sq->sq_list, ksi, ksi_link);
ksi->ksi_sigq = NULL;