[pulseaudio-discuss] [PATCH 4/6] core: add message handler

Tanu Kaskinen tanuk at iki.fi
Sun Oct 1 16:16:08 UTC 2017


On Sat, 2017-08-19 at 17:48 +0200, Georg Chini wrote:
> +/* List handlers */
> +char *pa_core_message_handler_list(pa_core *c);

Putting this function to core-messages.h doesn't seem right to me. The
function will never be used outside core.c, so the it should be a
private function in core.c.

> +static int core_message_handler(const char *recipient, const char *message, const char *message_parameters, char **response, void *userdata) {
> +    pa_core *c;
> +
> +    pa_assert(c = (pa_core *) userdata);
> +    pa_assert(message);
> +    pa_assert(response);
> +    pa_assert(pa_safe_streq(recipient, "/core"));
> +
> +    if (pa_streq(message, "list-handlers"))
> +        *response = pa_core_message_handler_list(c);
> +
> +    else
> +        *response = pa_xstrdup("Message not implemented");

This should be reported as a proper error. Who knows in what weird
context this string will appear if the caller can't distinguish an
error from a valid response.

-- 
Tanu

https://www.patreon.com/tanuk


More information about the pulseaudio-discuss mailing list