Re: [PATCH] staging: speakup: separate 80+ chars lines.

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

 



On Thu, Apr 19, 2018 at 03:47:10AM -0300, Andrew Jye Shih Chuang wrote:
> Increase readability of code following the Kernel coding style by breaking long lines and thus eliminating the checkpatch.pl warning.
> 
> Signed-off-by: Andrew Jye Shih Chuang <andrewjschuang@xxxxxxxxx>
> ---
>  drivers/staging/speakup/main.c | 15 +++++++++------
>  1 file changed, 9 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/staging/speakup/main.c b/drivers/staging/speakup/main.c
> index af30b70..2ba9989 100644
> --- a/drivers/staging/speakup/main.c
> +++ b/drivers/staging/speakup/main.c
> @@ -899,12 +899,13 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
>  	while (start < end) {
>  		sentbuf[bn][i] = get_char(vc, (u_short *)start, &tmp);
>  		if (i > 0) {
> -			if (sentbuf[bn][i] == SPACE && sentbuf[bn][i - 1] == '.' &&
> +			if (sentbuf[bn][i] == SPACE &&
> +			    sentbuf[bn][i - 1] == '.' &&
>  			    numsentences[bn] < 9) {
>  				/* Sentence Marker */
>  				numsentences[bn]++;
>  				sentmarks[bn][numsentences[bn]] =
> -				    &sentbuf[bn][i];
> +					&sentbuf[bn][i];
>  			}
>  		}

FWIW I personally feel that this multi-line condition block becomes even less
readable than it already was, and is one example where it's possibly better
to ignore the limit or organize the code different. Just as an example, this
one doing the same already looks more readable to me :


  		if (i > 0 && numsentences[bn] < 9 &&
		    sentbuf[bn][i] == SPACE && sentbuf[bn][i - 1] == '.') {
			/* Sentence Marker */
  			numsentences[bn]++;
  			sentmarks[bn][numsentences[bn]] = &sentbuf[bn][i];
  		}

Willy
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux