[PATCH libdrm 1/5] drm: add a macro DRMLISTFOREACHENTRYREVERSE

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

 



From: "Xiong, James" <james.xiong@xxxxxxxxx>

it goes through DRMLIST in a reverse order

Signed-off-by: Xiong, James <james.xiong@xxxxxxxxx>
---
 libdrm_lists.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libdrm_lists.h b/libdrm_lists.h
index 8926d8d..400c731 100644
--- a/libdrm_lists.h
+++ b/libdrm_lists.h
@@ -101,6 +101,12 @@ typedef struct _drmMMListHead
 	     (__item) = DRMLISTENTRY(typeof(*__item),                          \
 				     (__item)->__head.next, __head))
 
+#define DRMLISTFOREACHENTRYREVERSE(__item, __list, __head)                     \
+	for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->prev, __head); \
+	     &(__item)->__head != (__list);                                    \
+	     (__item) = DRMLISTENTRY(typeof(*__item),                          \
+				     (__item)->__head.prev, __head))
+
 #define DRMLISTFOREACHENTRYSAFE(__item, __temp, __list, __head)                \
 	for ((__item) = DRMLISTENTRY(typeof(*__item), (__list)->next, __head), \
 	     (__temp) = DRMLISTENTRY(typeof(*__item),                          \
-- 
2.7.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux