[pulseaudio-discuss] [PATCH v2 2/6] card: don't allow the CARD_NEW hook to fail
Tanu Kaskinen
tanuk at iki.fi
Sun Jun 12 20:12:08 UTC 2016
On Sun, 2016-06-12 at 18:19 +0500, Alexander E. Patrakov wrote:
> 10.06.2016 22:55, Tanu Kaskinen пишет:
> > There is currently no use for allowing modules to cancel card creation,
> > and I don't see need for that in the future either. Let's simplify
> > things by removing the failure handling code.
> > ---
> > src/pulsecore/card.c | 7 +------
> > 1 file changed, 1 insertion(+), 6 deletions(-)
> >
> > diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c
> > index 410746b..0ac70b9 100644
> > --- a/src/pulsecore/card.c
> > +++ b/src/pulsecore/card.c
> > @@ -149,12 +149,7 @@ pa_card *pa_card_new(pa_core *core, pa_card_new_data *data) {
> > }
> >
> > pa_card_new_data_set_name(data, name);
> > -
> > - if (pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_NEW], data) < 0) {
> > - pa_xfree(c);
> > - pa_namereg_unregister(core, name);
> > - return NULL;
> > - }
> > + pa_hook_fire(&core->hooks[PA_CORE_HOOK_CARD_NEW], data);
>
> No opinion here. Maybe the new code is OK, or maybe an assert should be
> added so that it is explicit that the hook is not expected to fail.
I'd prefer to not add an assertion. Most of pa_hook_fire() calls in the
code base don't check the return value, and none of the calls use an
assertion.
--
Tanu
More information about the pulseaudio-discuss
mailing list