aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-01-03 16:22:25 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-06-21 10:02:12 +0200
commit6aef068ada2a0f43be210b88b526d2eb1d4459ef (patch)
treea1228335b70c776fd3b891a5620e50c16c87faa7
parentb0a2f279e273c83917973fe3b51b7dd55ef81b0d (diff)
downloadsparse-dev-6aef068ada2a0f43be210b88b526d2eb1d4459ef.tar.gz
ptrlist: let sort_list() use the raw pointer
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@gmail.com>
-rw-r--r--sort.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sort.c b/sort.c
index 987199eb..101e0f0e 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);