HomeFreeBSD

rb_tree: reduce duplication in balancing code

Description

rb_tree: reduce duplication in balancing code

Change RB_INSERT_COLOR and RB_REMOVE_COLOR so that the blocks of code
that are identical except for left and right being exchanged are made
only one block with a variable to indicate left- or right-handedness.

Rename RB macros so that those not intended for external use begin
with an underscore.

Add comments to the balancing code so that another might understand it.

Reviewed by: alc, kib
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D36393

Details

Provenance
dougmAuthored on Sep 8 2022, 4:46 AM
Reviewer
alc
Differential Revision
D36393: rb_tree:stop symmetric code dup in insert/remove_color
Parents
rG6f7b1310b6fe: Hyper-V: storvsc: relax a couple more kasserts
Branches
Unknown
Tags
Unknown