mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-26 04:07:45 +03:00
More consistent use of TREE_* macros in AVL comparators
Where is it appropriate and obvious, use TREE_CMP(), TREE_ISIGN() and TREE_PCMP() instead or direct comparisons. It can make the code a lot smaller, less error prone, and easier to read. Sponsored-by: TrueNAS Reviewed-by: Alexander Motin <alexander.motin@TrueNAS.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <rob.norris@truenas.com> Closes #18259
This commit is contained in:
@@ -57,10 +57,12 @@ zfs_refcount_compare(const void *x1, const void *x2)
|
||||
const reference_t *r1 = (const reference_t *)x1;
|
||||
const reference_t *r2 = (const reference_t *)x2;
|
||||
|
||||
int cmp1 = TREE_CMP(r1->ref_holder, r2->ref_holder);
|
||||
int cmp2 = TREE_CMP(r1->ref_number, r2->ref_number);
|
||||
int cmp = cmp1 ? cmp1 : cmp2;
|
||||
return ((cmp || r1->ref_search) ? cmp : TREE_PCMP(r1, r2));
|
||||
int cmp = TREE_CMP(r1->ref_holder, r2->ref_holder);
|
||||
if (cmp == 0)
|
||||
cmp = TREE_CMP(r1->ref_number, r2->ref_number);
|
||||
if (cmp | r1->ref_search)
|
||||
return (cmp);
|
||||
return (TREE_PCMP(r1, r2));
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user