On Mon, 2011-03-28 at 17:54 -0400, Jerome Glisse wrote: > Hi, > > One short coming of macro has keep entertaining me until i figure out > what was wrong, here is > a simple scenario : > > Macro can lead to hard to debug list bugs. For instance consider > the following : > LIST_ADD(item, list->prev) > 3 instruction of the macro became : > (list->prev)->next->prev = item > which is equivalent to : > list->prev = item > Thus list prev field changes and next instruction in the macro > (list->prev)->next = item > became : > item->next = item > And you endup with list corruption, other case lead to similar > list corruption. Inline function are not affected by this short > coming > > Thus i propose to switch list manipulation from macro to inline > function, attached patch does exactly that. If there is no objection > in next couple of week i will merge it. (to avoid mass renaming it > keeps the macro that just wrap the functions it also add a bunch of > new list walking helper)
I'm ok with this. Those macros were supposed to be quick & dirty, but they've been around much longer than I ever expected... Keith _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev