On Fri, Nov 18, 2016 at 01:29:19AM +0100, Luc Van Oostenryck wrote: > On Thu, Nov 17, 2016 at 02:03:05PM -0800, Linus Torvalds wrote: > > On Thu, Nov 17, 2016 at 12:25 PM, Luc Van Oostenryck > > <luc.vanoostenryck@xxxxxxxxx> wrote: > > > > > > Would something like the following be fine? > > > > This looks good to me, although I didn't actually test it. But it > > looks like what I would have expected. > > > > Some of those inlines look large enough that I wonder how much sense > > they make as inlines any more, but I think that's a separate issue. > > Oh, I absolutely agree. > What I would like is something more iterator oriented which keep track > of the head-list-nr state. I have a working prototype I made last week > but it still needs some more polishing. > I've worked a bit more on this. I had a nice, clean & compact implementation where basically all ptr_list walking was done by something like: struct ptr_iter iter; ptr_iter_init(&iter, head); while ((ptr = ptr_iter_next(&iter))) ... Of course, still hidden under the macros which do the type checking. This had the advantage that all the logic was in a single place. It seemed to work well that is until I discovered that at a few places we're storing null pointers in ptr_lists. It's thus not possible to use the returned pointer to also check the end of list condition. The situation is even a bit more complex because the PREPARE/NEXT_PTR_LIST() also can't work with null pointers. I've found a few alternative that work in all the cases but they aren't simple & compact enough to my taste so I'll let things like they are and maybe just sent a few cleanups later. Luc -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html