[PATCH 8/9] ptrlist: let {first,last}_ptr_list() return the raw pointer

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

 



The functions {first,last}_ptr_list() strip tag from their entries but:
* there is no a single use of these functions on list with tagged pointers.
* the vast majority of ptrlists doesn't use tagged pointers
* the unsuffixed macro like FOR_EACH_PTR() doesn't strip anymore the
  tag from the entries, only the ones suffixed by _TAG do.
* tags are information attached to the entries, as such they may
  be needed when retrieved from the list.

Let do the same for {first,last}_ptr_list() and stop to unneedlessly
strip unexistant tags from the returned entries.

Of course, if needed, the returned entries can always be explicitly
untagged, preferably via an helper.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 ptrlist.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ptrlist.h b/ptrlist.h
index a737d421b..e3a84ea0a 100644
--- a/ptrlist.h
+++ b/ptrlist.h
@@ -77,7 +77,7 @@ static inline void *first_ptr_list(struct ptr_list *list)
 		if (list == head)
 			return NULL;
 	}
-	return PTR_ENTRY_UNTAG(list, 0);
+	return PTR_ENTRY_NOTAG(list, 0);
 }
 
 static inline void *last_ptr_list(struct ptr_list *list)
@@ -92,7 +92,7 @@ static inline void *last_ptr_list(struct ptr_list *list)
 			return NULL;
 		list = list->prev;
 	}
-	return PTR_ENTRY_UNTAG(list, list->nr-1);
+	return PTR_ENTRY_NOTAG(list, list->nr-1);
 }
 
 #define PTR_DEREF(__head, idx, PTR_ENTRY) ({						\
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux