[coreboot-gerrit] New patch to review for coreboot: libpayload: queue: Add a helper macro for checking singleton queue

Patrick Georgi (pgeorgi@google.com) gerrit at coreboot.org
Thu Nov 12 00:09:55 CET 2015


Patrick Georgi (pgeorgi at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/12412

-gerrit

commit f9260693d30f31f368738e74ad14cc9cc5c5ced4
Author: Furquan Shaikh <furquan at google.com>
Date:   Fri Nov 6 22:20:15 2015 -0800

    libpayload: queue: Add a helper macro for checking singleton queue
    
    Check if the simple queue consists of only 1 element.
    
    BUG=b:24676003
    BRANCH=None
    TEST=Compiles successfully.
    
    Change-Id: Ib257a5e6b9042b42c549f8ad8b943e3b75fd8c9c
    Signed-off-by: Patrick Georgi <pgeorgi at chromium.org>
    Original-Commit-Id: 5435d6fec1c4fbb4c04ba5b8c15caff9ee4e50f0
    Original-Change-Id: I7a8cb9c4e7e71956e85e65b3e7b8e0af4d354110
    Original-Signed-off-by: Furquan Shaikh <furquan at google.com>
    Original-Reviewed-on: https://chromium-review.googlesource.com/311256
    Original-Commit-Ready: Furquan Shaikh <furquan at chromium.org>
    Original-Tested-by: Furquan Shaikh <furquan at chromium.org>
    Original-Reviewed-by: Aaron Durbin <adurbin at chromium.org>
---
 payloads/libpayload/include/queue.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/payloads/libpayload/include/queue.h b/payloads/libpayload/include/queue.h
index f8f09bf..2b64669 100644
--- a/payloads/libpayload/include/queue.h
+++ b/payloads/libpayload/include/queue.h
@@ -268,6 +268,9 @@ struct {								\
 #define	SIMPLEQ_END(head)	    NULL
 #define	SIMPLEQ_EMPTY(head)	    (SIMPLEQ_FIRST(head) == SIMPLEQ_END(head))
 #define	SIMPLEQ_NEXT(elm, field)    ((elm)->field.sqe_next)
+#define	SIMPLEQ_TAIL_NEXT(head)     ((head)->sqh_last)
+#define	SIMPLEQ_SINGLETON(head, field)				\
+	(&SIMPLEQ_NEXT(SIMPLEQ_FIRST(head), field) == SIMPLEQ_TAIL_NEXT(head))
 
 #define SIMPLEQ_FOREACH(var, head, field)				\
 	for((var) = SIMPLEQ_FIRST(head);				\



More information about the coreboot-gerrit mailing list