public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: Andrew Jye Shih Chuang <andrewjschuang@gmail.com>
Cc: William Hubbs <w.d.hubbs@gmail.com>,
	Chris Brannon <chris@the-brannons.com>,
	Kirk Reiser <kirk@reisers.ca>,
	Samuel Thibault <samuel.thibault@ens-lyon.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	speakup@linux-speakup.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org,
	lkcamp-request@lists.libreplanetbr.org
Subject: Re: [PATCH] staging: speakup: separate 80+ chars lines.
Date: Thu, 19 Apr 2018 08:55:24 +0200	[thread overview]
Message-ID: <20180419065524.GC21220@1wt.eu> (raw)
In-Reply-To: <5ad83b71.1c69fb81.f8458.0d85@mx.google.com>

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@gmail.com>
> ---
>  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

  reply	other threads:[~2018-04-19  6:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-19  6:47 [PATCH] staging: speakup: separate 80+ chars lines Andrew Jye Shih Chuang
2018-04-19  6:55 ` Willy Tarreau [this message]
2018-04-19  7:51 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180419065524.GC21220@1wt.eu \
    --to=w@1wt.eu \
    --cc=andrewjschuang@gmail.com \
    --cc=chris@the-brannons.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=kirk@reisers.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkcamp-request@lists.libreplanetbr.org \
    --cc=samuel.thibault@ens-lyon.org \
    --cc=speakup@linux-speakup.org \
    --cc=w.d.hubbs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox