Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> So what happens when someone wants to use list_nth in one of the
> outfuncs? Would we then rip all these back out?
If we just go this far and don't create a separate const flavor of
the one function and two macros, then we would at least need to rip
out the const keyword on the parameter of the affected function(s).
> Or would we then bite the bullet and duplicate the code?
I'm not sure we shouldn't go that far right up front. The entire
body of the only duplicated function is:
return l ? l->head : NULL;
As cloned code goes, I've seen worse.
Of the two new macros, one has three lines of body, the other has
one line.
If people aren't inclined to support this on the grounds of API
clarity, maybe we should do some sort of benchmark run while we have
a patch which applies cleanly before writing off the possible
performance impact, but I'm not sure what makes a good stress-test
for the affected code.
-Kevin