[PATCH 9/9] ptrlist: let sort_list() use the raw pointer

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

 



The function sort_list() always strip tag from their entries but:
* there is no a single use of this function 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 for dping the comparion.

So, be consistent and stop to unneedlessly strip (unexistent) tags
from the pointers. If used on tagged pointers it's always possible
and easy to explicitly strip the tag in teh comparison function.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 sort.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sort.c b/sort.c
index 987199eb3..101e0f0e4 100644
--- a/sort.c
+++ b/sort.c
@@ -138,7 +138,7 @@ merge_block_seqs (struct ptr_list *b1, int n,
 	// Do a quick skip in case entire blocks from b1 are
 	// already less than smallest element in b2.
 	while (b1->nr == 0 ||
-	       cmp (PTR_ENTRY_UNTAG(b1, b1->nr - 1), PTR_ENTRY_UNTAG(b2,0)) < 0) {
+	       cmp (PTR_ENTRY_NOTAG(b1, b1->nr - 1), PTR_ENTRY_NOTAG(b2,0)) < 0) {
 		// printf ("Skipping whole block.\n");
 		BEEN_THERE('H');
 		b1 = b1->next;
@@ -149,8 +149,8 @@ merge_block_seqs (struct ptr_list *b1, int n,
 	}
 
 	while (1) {
-		const void *d1 = PTR_ENTRY_UNTAG(b1,i1);
-		const void *d2 = PTR_ENTRY_UNTAG(b2,i2);
+		const void *d1 = PTR_ENTRY_NOTAG(b1,i1);
+		const void *d2 = PTR_ENTRY_NOTAG(b2,i2);
 
 		assert (i1 >= 0 && i1 < b1->nr);
 		assert (i2 >= 0 && i2 < b2->nr);
-- 
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