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 Define list_entry_firs...



details:   https://anonhg.NetBSD.org/src/rev/9142edf4b14b
branches:  trunk
changeset: 364305:9142edf4b14b
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 27 06:55:43 2018 +0000

description:
Define list_entry_first_or_null.

diffstat:

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

diffs (18 lines):

diff -r e226cb3eafd2 -r 9142edf4b14b sys/external/bsd/common/include/linux/list.h
--- a/sys/external/bsd/common/include/linux/list.h      Mon Aug 27 06:55:32 2018 +0000
+++ b/sys/external/bsd/common/include/linux/list.h      Mon Aug 27 06:55:43 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: list.h,v 1.9 2018/08/27 06:54:19 riastradh Exp $       */
+/*     $NetBSD: list.h,v 1.10 2018/08/27 06:55:43 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -199,6 +199,8 @@
 #define        list_entry(PTR, TYPE, FIELD)    container_of(PTR, TYPE, FIELD)
 #define        list_first_entry(PTR, TYPE, FIELD)                              \
        list_entry(list_first((PTR)), TYPE, FIELD)
+#define        list_first_entry_or_null(PTR, TYPE, FIELD)                      \
+       (list_empty((PTR)) ? NULL : list_entry(list_first((PTR)), TYPE, FIELD))
 #define        list_last_entry(PTR, TYPE, FIELD)                               \
        list_entry(list_last((PTR)), TYPE, FIELD)
 #define        list_next_entry(ENTRY, FIELD)                                   \



Home | Main Index | Thread Index | Old Index