Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/external/bsd/common/include/linux Give hlist iteration h...



details:   https://anonhg.NetBSD.org/src/rev/a5d9ddccb01e
branches:  trunk
changeset: 992808:a5d9ddccb01e
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 07:51:49 2018 +0000

description:
Give hlist iteration half a chance of working, oops.

diffstat:

 sys/external/bsd/common/include/linux/list.h |  17 +++++++----------
 1 files changed, 7 insertions(+), 10 deletions(-)

diffs (38 lines):

diff -r 3aec06d6bfff -r a5d9ddccb01e sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h      Mon Aug 27 07:51:37 2018 +0000
+++ b/sys/external/bsd/common/include/linux/list.h      Mon Aug 27 07:51:49 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.15 2018/08/27 07:33:09 riastradh Exp $      */
+/*     $NetBSD: list.h,v 1.16 2018/08/27 07:51:49 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -305,9 +305,8 @@
 #define        hlist_for_each(VAR, HEAD)                                             \
        for ((VAR) = hlist_first(HEAD); (VAR) != NULL; (VAR) = hlist_next(VAR))
 #define        hlist_for_each_safe(VAR, NEXT, HEAD)                                  \
-       for ((VAR) = hlist_first(HEAD),                                       \
-                   (NEXT) = ((VAR) == NULL ? NULL : hlist_next(HEAD));       \
-               (VAR) != NULL;                                                \
+       for ((VAR) = hlist_first(HEAD);                                       \
+               (VAR) != NULL && ((NEXT) = hlist_next(HEAD), 1);              \
                (VAR) = (NEXT))
 #define        hlist_for_each_entry(VAR, HEAD, FIELD)                                \
        for ((VAR) = (hlist_first(HEAD) == NULL ? NULL :                      \
@@ -321,12 +320,10 @@
 #define        hlist_for_each_entry_safe(VAR, NEXT, HEAD, FIELD)                     \
        for ((VAR) = (hlist_first(HEAD) == NULL ? NULL :                      \
                        hlist_entry(hlist_first(HEAD), typeof(*(VAR)),        \
-                           FIELD)),                                          \
-                   (NEXT) = ((VAR) == NULL ? NULL :                          \
-                       hlist_next(&(VAR)->FIELD));                           \
-               (VAR) != NULL;                                                \
-               (VAR) = ((NEXT) == NULL ? NULL :                              \
-                           hlist_entry((NEXT), typeof(*(VAR)), FIELD)))
+                           FIELD));                                          \
+               ((VAR) != NULL &&                                             \
+                   ((NEXT) = hlist_next(&(VAR)->FIELD), 1));                 \
+               (VAR) = hlist_entry((NEXT), typeof(*(VAR)), FIELD))
 
 #define        hlist_add_behind_rcu(n, p)      pslist_writer_insert_after(p, n)
 #define        hlist_add_head_rcu(n, h)        pslist_writer_insert_head(h, n)



Home | Main Index | Thread Index | Old Index