On Fri, 2010-07-23 at 16:14 -0700, Denis Kenzior wrote:
> Hi Inaky,
>
> >> tx_queue_entry * here. Casting the destructor in g_foo_foreach is
> >> acceptable.
> >
> > Heh, I'd rather have it like this: Repeat after me in a 1000-loop: casts
> > are evil and should be avoided for they muck the code by hiding warnings
> > when you change things and miss updating all the sites ...
> >
>
> I fully agree, but the extra silly NULL argument makes this worse than
> the cast. And to be clear, g_foo_foreach is about the only place we
> explicitly allow casts. If you feel you need to be pedantic, then write
> a GFunc specifically to do the foreach bit.
>
> e.g. tx_queue_entry_free(struct tx_queue_entry *);
>
> txq_foreach_free(gpointer foo, gpointer user)
> {
> struct tx_queue_entry *bar = foo;
> tx_queue_entry_free(bar);
> }
>
Done
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono