mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +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:
+3
-14
@@ -45,21 +45,10 @@ struct launched_process_node {
|
||||
static int
|
||||
_launched_process_node_compare(const void *x1, const void *x2)
|
||||
{
|
||||
pid_t p1;
|
||||
pid_t p2;
|
||||
const struct launched_process_node *node1 = x1;
|
||||
const struct launched_process_node *node2 = x2;
|
||||
|
||||
assert(x1 != NULL);
|
||||
assert(x2 != NULL);
|
||||
|
||||
p1 = ((const struct launched_process_node *) x1)->pid;
|
||||
p2 = ((const struct launched_process_node *) x2)->pid;
|
||||
|
||||
if (p1 < p2)
|
||||
return (-1);
|
||||
else if (p1 == p2)
|
||||
return (0);
|
||||
else
|
||||
return (1);
|
||||
return (TREE_CMP(node1->pid, node2->pid));
|
||||
}
|
||||
|
||||
static pthread_t _reap_children_tid = (pthread_t)-1;
|
||||
|
||||
Reference in New Issue
Block a user