Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Sep 2012 22:54:11 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240426 - head/sys/sys
Message-ID:  <201209122254.q8CMsBjx064951@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Wed Sep 12 22:54:11 2012
New Revision: 240426
URL: http://svn.freebsd.org/changeset/base/240426

Log:
  Correctness: use __member2struct() on the correct fields.
  
  The prev-pointers point to the next-pointers of the previous element --
  not the ENTRY structure. The next-pointers are stored in the ENTRY
  structures first, so the code would already work correctly. Still, it is
  more accurate to use the next-fields.
  
  To prevent misuse of __member2struct() in the future, I've got a patch
  that requires the pointer to be passed to this macro to be compatible
  with the member of the structure. I'll commit this patch after I've
  tested it properly.
  
  MFC after:	1 month.

Modified:
  head/sys/sys/queue.h

Modified: head/sys/sys/queue.h
==============================================================================
--- head/sys/sys/queue.h	Wed Sep 12 22:16:31 2012	(r240425)
+++ head/sys/sys/queue.h	Wed Sep 12 22:54:11 2012	(r240426)
@@ -289,7 +289,7 @@ struct {								\
 #define	STAILQ_LAST(head, type, field)					\
 	(STAILQ_EMPTY((head)) ?						\
 		NULL :							\
-		__member2struct(type, field, (head)->stqh_last))
+		__member2struct(type, field.stqe_next, (head)->stqh_last))
 
 #define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next)
 
@@ -427,7 +427,7 @@ struct {								\
 #define	LIST_PREV(elm, head, type, field)				\
 	((elm)->field.le_prev == &LIST_FIRST((head)) ?			\
 		NULL :							\
-		__member2struct(type, field, (elm)->field.le_prev))
+		__member2struct(type, field.le_next, (elm)->field.le_prev))
 
 #define	LIST_REMOVE(elm, field) do {					\
 	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209122254.q8CMsBjx064951>