lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 26 May 2014 16:28:28 +0200
From:	Willy Tarreau <w@....eu>
To:	Dominique van den Broeck <domdevlin@...e.fr>
Cc:	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/3] staging: panel: (coding style) Matching braces

Hi Dominique,

On Wed, May 21, 2014 at 02:09:59PM +0200, Dominique van den Broeck wrote:
> Style-only modifications to comply with checkpatch.pl --strict --file. 
> . Adds every missing brace in condition statements.
> 
> Signed-off-by: Dominique van den Broeck <domdevlin@...e.fr>
> ---
> Apply on linux-next tree, above:
> commit 4151fa6adc65da14673ece623bbb2acc6936f8be
> "Add linux-next specific files for 20140516"
> 
> diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c
> index 136671a..1ac5e25 100644
> --- a/drivers/staging/panel/panel.c
> +++ b/drivers/staging/panel/panel.c
> @@ -711,10 +711,9 @@ static void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val)
>  /* sleeps that many milliseconds with a reschedule */
>  static void long_sleep(int ms)
>  {
> -
> -	if (in_interrupt())
> +	if (in_interrupt()) {
>  		mdelay(ms);
> -	else {
> +	} else {

I don't want to be nit-picking, but since we're talking about style...
for me these "} else {" statements are harder to parse than having them
on two lines this way :

         }
         else {

That's especially more true with "else if" as below :

		} else if (*esc >= 'A' && *esc <= 'Z') {
			value |= (*esc - 'A' + 10) << shift;
		} else if (*esc >= 'a' && *esc <= 'z') {
			value |= (*esc - 'a' + 10) << shift;
		} else {

I believe that most of the kernel code prefers the two-line format resluting
in this instead :

		}
		else if (*esc >= 'A' && *esc <= 'Z') {
			value |= (*esc - 'A' + 10) << shift;
		}
		else if (*esc >= 'a' && *esc <= 'z') {
			value |= (*esc - 'a' + 10) << shift;
		}
		else {

It's just a matter of taste I know, but for me they read easier, probably
because the braces do not affect alignment and the lines appear exactly
similar with or without the braces.

Thanks,
Willy

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ