Re: [PATCH] openpromfs: Adjust three seq_printf() calls in property_show()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2019-07-02 at 17:40 +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@xxxxxxxxxxxxxxxxxxxxx>
> Date: Tue, 2 Jul 2019 17:24:27 +0200
> 
> A bit of information should be put into a sequence.
> Thus improve the execution speed for this data output by better usage
> of corresponding functions.
> 
> This issue was detected by using the Coccinelle software.

(wasn't Markus perma-banned?)

> diff --git a/fs/openpromfs/inode.c b/fs/openpromfs/inode.c
[]
> @@ -76,14 +76,14 @@ static int property_show(struct seq_file *f, void *v)
>  		while (len > 0) {
>  			int n = strlen(pval);
> 
> -			seq_printf(f, "%s", (char *) pval);
> +			seq_puts(f, (char *) pval);
> 
>  			/* Skip over the NULL byte too.  */
>  			pval += n + 1;
>  			len -= n + 1;
> 
>  			if (len > 0)
> -				seq_printf(f, " + ");
> +				seq_puts(f, " + ");
>  		}
>  	} else {
>  		if (len & 3) {
> @@ -111,8 +111,7 @@ static int property_show(struct seq_file *f, void *v)
>  			}
>  		}
>  	}
> -	seq_printf(f, "\n");
> -
> +	seq_putc(f, '\n');
>  	return 0;
>  }

If this is really useful (and it's really not),
at least change void *pval to char *pval and
remove a bunch of useless casts.





[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux