[pulseaudio-discuss] [PATCH v3 4/7] bluetooth: Set off profile on SCO disconnect

Dalleau, Frederic frederic.dalleau at intel.com
Mon Oct 3 01:18:45 PDT 2011


Hi Arun,

Thanks for review,

>> -struct userdata {
>> +struct bluetooth_device {
>
> What's the rationale behind this? While the whole "struct userdata"
> business makes code navigation just a bit hard sometimes, broadly it's
> handy as a convention across modules.

I don't know why but that made the code much more understandable to me ;)
However, if it's a convention then I'll stick to it.

> Would it make sense perhaps to make a separate msgobject for the
> bluetooth device/card with just the pa_card so you can pass that around
> instead?

That's a good idea, I didn't feel confortable mixing msgobject with
struct userdata!

>> -    m->userdata = u = pa_xnew0(struct userdata, 1);
>> +    u = pa_msgobject_new(bluetooth_device);
>> +    memset(((char*)u)+sizeof(u->parent), 0, sizeof(*u)-sizeof(u->parent));
>
> Maybe I'm being dense, but why is sizeof(*u) not sufficient here?

pa_msgobject_new will initialize some fields in the msgobject at the
beginning of *u, so I don't want to overwrite these field, I also
don't want to overflow u.
But if the message object goes in a separate struct, then there is no
longer the need to use memset if only one field (card) is to be set.

Regards,
Frédéric


More information about the pulseaudio-discuss mailing list