[alsa-devel] [PATCH next 16/16] sound: Use static const char * const where possible

Takashi Iwai tiwai at suse.de
Tue Sep 14 16:17:36 CEST 2010


At Mon, 13 Sep 2010 21:24:02 -0700,
Joe Perches wrote:
> 
> Signed-off-by: Joe Perches <joe at perches.com>

Applied the second chunk (as the first chunk is the revert of your
previous patch).


thanks,

Takashi

> ---
>  sound/core/misc.c       |    5 +----
>  sound/core/pcm_native.c |    2 +-
>  2 files changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/core/misc.c b/sound/core/misc.c
> index 0e5e77f..2c41825 100644
> --- a/sound/core/misc.c
> +++ b/sound/core/misc.c
> @@ -64,15 +64,12 @@ static int print_snd_pfx(unsigned int level, const char *path, int line,
>  			 const char *format)
>  {
>  	const char *file = sanity_file_name(path);
> -	char tmp[sizeof("<0>")];
> +	char tmp[] = "<0>";
>  	const char *pfx = level ? KERN_DEBUG : KERN_DEFAULT;
>  	int ret = 0;
>  
>  	if (format[0] == '<' && format[2] == '>') {
> -		tmp[0] = '<';
>  		tmp[1] = format[1];
> -		tmp[2] = '>';
> -		tmp[3] = 0;
>  		pfx = tmp;
>  		ret = 1;
>  	}
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index e2e7389..eb40942 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -142,7 +142,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
>  
>  #ifdef RULES_DEBUG
>  #define HW_PARAM(v) [SNDRV_PCM_HW_PARAM_##v] = #v
> -char *snd_pcm_hw_param_names[] = {
> +static const char * const snd_pcm_hw_param_names[] = {
>  	HW_PARAM(ACCESS),
>  	HW_PARAM(FORMAT),
>  	HW_PARAM(SUBFORMAT),
> -- 
> 1.7.3.rc1
> 


More information about the Alsa-devel mailing list