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:
Rob Norris
2026-03-04 04:08:23 +11:00
committed by GitHub
parent 0f90a797dd
commit 1e2c94a043
19 changed files with 88 additions and 199 deletions
+2 -2
View File
@@ -90,8 +90,8 @@ static int
kcf_mech_hash_compar(const void *lhs, const void *rhs)
{
const kcf_mech_entry_t *l = lhs, *r = rhs;
int cmp = strncmp(l->me_name, r->me_name, CRYPTO_MAX_MECH_NAME);
return ((0 < cmp) - (cmp < 0));
return (TREE_ISIGN(strncmp(l->me_name, r->me_name,
CRYPTO_MAX_MECH_NAME)));
}
void