[Glibc-bsd-commits] r5101 - in trunk/freebsd-glue: debian include/sys

Robert Millan rmh at alioth.debian.org
Sun Oct 27 22:55:07 UTC 2013


Author: rmh
Date: 2013-10-27 22:55:07 +0000 (Sun, 27 Oct 2013)
New Revision: 5101

Modified:
   trunk/freebsd-glue/debian/changelog
   trunk/freebsd-glue/include/sys/queue.h
Log:
Add STAILQ_LAST() to <sys/queue.h>.

Modified: trunk/freebsd-glue/debian/changelog
===================================================================
--- trunk/freebsd-glue/debian/changelog	2013-10-27 22:54:48 UTC (rev 5100)
+++ trunk/freebsd-glue/debian/changelog	2013-10-27 22:55:07 UTC (rev 5101)
@@ -5,6 +5,7 @@
 
   [ rmh ]
   * Add <osreldate.h> and <sys/limits.h>.
+  * Add STAILQ_LAST() to <sys/queue.h>.
 
  -- Robert Millan <rmh at debian.org>  Sat, 26 Oct 2013 17:48:31 +0200
 

Modified: trunk/freebsd-glue/include/sys/queue.h
===================================================================
--- trunk/freebsd-glue/include/sys/queue.h	2013-10-27 22:54:48 UTC (rev 5100)
+++ trunk/freebsd-glue/include/sys/queue.h	2013-10-27 22:55:07 UTC (rev 5101)
@@ -74,6 +74,14 @@
 	    (var) = (tvar))
 #endif
 
+#ifndef STAILQ_LAST
+#define	STAILQ_LAST(head, type, field)					\
+	(STAILQ_EMPTY((head)) ?						\
+		NULL :							\
+	        ((struct type *)(void *)				\
+		((char *)((head)->stqh_last) - __offsetof(struct type, field))))
+#endif
+
 #ifndef TAILQ_FOREACH_SAFE 
 #define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\
 	for ((var) = ((head)->tqh_first);				\




More information about the Glibc-bsd-commits mailing list