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/2094ced340a6
branches:  trunk
changeset: 365837:2094ced340a6
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 f16780e1c6dd -r 2094ced340a6 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