control: Fix a bug that prevented namehint behaviour
control: Fix a bug that prevented namehint behaviour

Looks like the documented behaviour was broken in commit 1ba513f9 in
2006, with the introduction of multiple fields.

I've chosen to match the described behaviour. Prior to this patch,
using namehint could be made to work by exploiting the lack of escaping
of the "name", populating the other fields:

  "plug:front|DESCDo all conversions for front speakers"

rather than that which is documented and presumed to be the intention
for asoundrc files:

  "plug:front|Do all conversions for front speakers"

Everything seems to strongly suggest nobody is using this feature; I can
find no working examples through a web search and probably someone
would have hit this bug. It's not documented in configuration, only in
the snd_device_name_hint() call. So it would probably clutter things to
provide compatibility for the old behaviour.

I have found it to be very useful since working in Chromium, where it is
the only way to expose chosen ALSA devices to web applications.

A temporary buffer is required to null-terminate the string.  I see no
use of alloca() in the code, presumably to avoid unbounded stack size.
So memory is allocated on the heap.

Signed-off-by: Mark Hills <f1b5a91d4d6ad523f2610114591c007e75d15084@xwax.org>
Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>

tiwai/alsa-lib,takaswie/alsa-lib,tiwai/alsa-lib,alsa-project/alsa-lib,alsa-project/alsa-lib,alsa-project/alsa-lib,takaswie/alsa-lib,takaswie/alsa-lib,alsa-project/alsa-lib,tiwai/alsa-lib,tiwai/alsa-lib,takaswie/alsa-lib,takaswie/alsa-lib