[alsa-devel] [PATCH] ALSA: Warn when control names are truncated

Jaroslav Kysela perex at perex.cz
Wed Oct 29 15:51:40 CET 2008


On Wed, 29 Oct 2008, Takashi Iwai wrote:

> At Wed, 29 Oct 2008 14:40:30 +0000,
> Mark Brown wrote:
> > 
> > This is likely to confuse user interfaces since the end of the control
> > name is interpreted (eg, "Volume", "Switch").
> > 
> > Signed-off-by: Mark Brown <broonie at opensource.wolfsonmicro.com>
> 
> Thanks, applied now.
> 
> 
> > +		if (strcmp(ncontrol->name, kctl.id.name) != 0)

Maybe better is to just use end char comparsion to save few CPU ticks:

if (kctl.id.name[sizeof(kctl.id.name)-2] != '\0' &&
    ncontrol->name[sizeof(kctl.id.name)-1] != '\0')
	print_warning_here;

					Jaroslav

-----
Jaroslav Kysela <perex at perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.



More information about the Alsa-devel mailing list