> > > > > > Do we need this change? > > > > > This patch does not tend to refactor the code. I have removed extra empty > > lines because i touched the code around. I can either keep that change or > > remove it. What is your opinion? > > Usually it's better to separate cosmetic changes from functional, if you're > not touching directly these lines. Not a big deal, of course. > OK. I will keep it as it used to be. When it is a time for refactoring we can fix that. > > > > > > The function looks much cleaner now, thank you! > > > > > > But if I understand it correctly, it returns a node (via parent) > > > and a pointer to one of two links, so that the returned value > > > is always == parent + some constant offset. > > > If so, I wonder if it's cleaner to return a parent node > > > (as rb_node*) and a bool value which will indicate if the left > > > or the right link should be used. > > > > > > Not a strong opinion, just an idea. > > > > > I see your point. Yes, that is possible to return "bool" value that > > indicates left or right path. After that we can detect the direction. > > > > From the other hand, we end up and access the correct link anyway during > > the traversal the tree. In case of "bool" way, we will need to add on top > > some extra logic that checks where to attach to. > > Sure, makes sense. I'd add some comments here then. > Will put some explanation and description. Thank you! -- Vlad Rezki