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);
}

Regards,
-Denis
_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to