CVSROOT: /cvs Module name: src Changes by: d...@cvs.openbsd.org 2017/06/07 21:12:53
Modified files: share/man/man9 : RBT_INIT.9 sys/sys : tree.h sys/kern : subr_tree.c Log message: add RBT_SET_LEFT, RBT_SET_RIGHT, and RBT_SET_PARENT this are provided so an RBT and it's topology can be copied without having to reinsert the copied nodes into a new tree. there are two reasons RBT_LEFT/RIGHT/PARENT macros cant be used like RB_LEFT/RIGHT/PARENT for this. firstly, RBT_LEFT and co are functions that return a pointer value, they dont provide access to the pointer itself for use as an lvalue that you can assign to. secondly, RBT entries dont store pointers to other nodes, they point to the RBT_ENTRY structures inside other nodes. this means that RBT_SET_LEFT and co have to get an offset from the node to the RBT_ENTRY and store that.