[pulseaudio-discuss] [PATCH 6/6] ucm: Add support for "JackHWMute"
Tanu Kaskinen
tanu.kaskinen at linux.intel.com
Mon Mar 23 09:51:28 PDT 2015
On Mon, 2015-03-23 at 18:39 +0530, Arun Raghavan wrote:
> I'm not super-fussed about struct ucm_port vs. struct port, but I do
> prefer the former if you're not dead against it. I'll leave the final
> call on this to you.
I'm not dead against it, I'll change it to struct ucm_port. Or actually
I changed it already before you got around to writing your reply :)
> >> > @@ -1591,6 +1820,15 @@ void pa_alsa_ucm_free(pa_alsa_ucm_config *ucm) {
> >> > pa_alsa_ucm_verb *vi, *vn;
> >> > pa_alsa_jack *ji, *jn;
> >> >
> >> > + if (ucm->ports) {
> >> > + struct port *port;
> >> > +
> >> > + while ((port = pa_dynarray_last(ucm->ports)))
> >> > + port_free(port);
> >>
> >> Should just pass port_free() as the free function in pa_dynarray_new().
> >
> > Well, that depends... With the current code port_free() is responsible
> > for removing itself from the dynarray, which makes sense, since
> > port_new() is responsible for adding the port to the dynarray. I'd
> > really like to keep that symmetry.
>
> Setting the free function up front makes it less likely that someone
> calling remove on the dynarray will forget to free the instance too,
> so IMO setting the free function is just good practice.
Well, the ports should never be removed from the dynarray anywhere else
than in port_free(), so that scenario should never occur...
If you insist that I should pass port_free() to pa_dynarray_new(), I'll
also have to change pa_dynarray_free(), because currently it doesn't
work correctly, if items are removed from the array inside the free
callback.
--
Tanu
More information about the pulseaudio-discuss
mailing list