Hi Arun, The patch works well in my test, I have it called in ucm. And I have committed some new patches at http://git.linaro.org/gitweb?p=people/weifeng/pulseaudio.git;a=shortlog, to make the code better. 2012/6/13 Arun Raghavan <arun.raghavan at collabora.co.uk>: > Hi, > > On Mon, 2012-06-11 at 18:28 +0800, Feng Wei wrote: > [snip] >> >> +static int ucm_port_contain(const char *port_name, const char *dev_name) { >> >> + ? ?int ret=0; >> >> + ? ?char *r; >> >> + ? ?const char *state=NULL; >> >> + >> >> + ? ?if (!port_name || !dev_name) >> >> + ? ? ? ?return FALSE; >> >> + >> >> + ? ?while ((r = pa_split(port_name, "+", &state))) { >> >> + ? ? ? ?if (!strcmp(r, dev_name)) { >> >> + ? ? ? ? ? ?pa_xfree(r); >> >> + ? ? ? ? ? ?ret = 1; >> >> + ? ? ? ? ? ?break; >> >> + ? ? ? ?} >> >> + ? ? ? ?pa_xfree(r); >> >> + ? ?} >> >> + ? ?return ret; >> >> +} >> > >> > Better to use strstr() here. Avoids some unnecessary allocation + >> > deallocation. >> Is it possible that we have sub string matching in error? > > I'm attaching a patch snippet of something that might be useful instead. > Untested, but should work -- if it looks fine, I can commit this. > > One comment that I missed, I think -- I see that you've called > structures pa_alsa_ucm_* and functions pa_ucm_*. Could you make them all > pa_alsa_ucm_*? > > Thanks for all the efforts, > Arun > > _______________________________________________ > pulseaudio-discuss mailing list > pulseaudio-discuss at lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss > -- Wei.Feng (irc wei_feng) Linaro Multimedia Team Linaro.org???Open source software for ARM SoCs Follow?Linaro:?Facebook?|?Twitter?|?Blog