lkml.org 
[lkml]   [2018]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: speakup: separate 80+ chars lines.
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

\
 
 \ /
  Last update: 2018-04-19 08:56    [W:0.028 / U:0.140 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site