Re: [PATCH 1/5] perf tools: Factor ui_browser ops out of ui_browser struct

From: Namhyung Kim
Date: Thu Jun 19 2014 - 19:34:00 EST


Hi Jiri,

On Thu, 19 Jun 2014 18:49:21 +0200, Jiri Olsa wrote:
> On Thu, Jun 19, 2014 at 12:38:51PM -0300, Arnaldo Carvalho de Melo wrote:
>> Em Thu, Jun 19, 2014 at 01:41:12PM +0200, Jiri Olsa escreveu:
>> > Separating ops out of 'struct ui_browser' into
>> > 'struct ui_browser_ops'.
>>
>> You stated what you did, and that helps in understanding what this patch
>> is about, now we only need to have a paragraph on _why_ this is needed
>> :-)
>
> well.. it's not ;-) but we always separated ops from the
> structs IIRC
>
> I introduced another callback in the early stage of this change,
> but replaced it later.. this remained ;-)
>
> no need to take it.. as I wrote in patch 0:
>
> Patches 1 and 2 are not necessary for the functionality,
> they are just byproducts of another early way I tried,
> but I think they could go in.

Hmm.. I think it should make the ops const, otherwise it makes only a
little sense.


[SNIP]
>> > +static bool ui_browser__filter(struct ui_browser *browser, void *entry)
>> > +{
>> > + return browser->ops.filter ? browser->ops.filter(browser, entry) :
>> > + false;
>> > +}
>> > +
>> > static struct list_head *
>> > ui_browser__list_head_filter_entries(struct ui_browser *browser,
>> > struct list_head *pos)
>> > {
>> > do {
>> > - if (!browser->filter || !browser->filter(browser, pos))
>> > + if (!ui_browser__filter(browser, pos))

Looks like this can be a separate cleanup.

Thanks,
Namhyung


>> > return pos;
>> > pos = pos->next;
>> > } while (pos != browser->entries);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/