qemu-trivial.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-trivial] [PATCH v2 0/2] util/readline: errors clean-ups
@ 2019-04-01  2:44 Jules Irenge
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool Jules Irenge
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Jules Irenge @ 2019-04-01  2:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

This v2 version combines two fix of errors into one  and replace tab
indent by four spaces

Jules Irenge (2):
  util/readline: add a space to fix errors by checkpatch tool
  util: readline: replace tab indent by four spaces to fix checkpatch
    errors

 util/readline.c | 132 ++++++++++++++++++++++++------------------------
 1 file changed, 66 insertions(+), 66 deletions(-)

-- 
2.20.1



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-trivial] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool
  2019-04-01  2:44 [Qemu-trivial] [PATCH v2 0/2] util/readline: errors clean-ups Jules Irenge
@ 2019-04-01  2:44 ` Jules Irenge
  2019-04-01  5:23   ` [Qemu-trivial] [Qemu-devel] " Thomas Huth
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 2/2] util: readline: replace tab indent by four spaces to fix checkpatch errors Jules Irenge
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 7+ messages in thread
From: Jules Irenge @ 2019-04-01  2:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

util/readline: add a space to fix errors reported by checkpatch.pl tool
"ERROR: space required before the open parenthesis"
"ERROR: space required after that ..."
within "util/redline.c" file

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 util/readline.c | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/util/readline.c b/util/readline.c
index ec91ee0fea..db399d3948 100644
--- a/util/readline.c
+++ b/util/readline.c
@@ -48,13 +48,13 @@ static void readline_update(ReadLineState *rs)
 
     if (rs->cmd_buf_size != rs->last_cmd_buf_size ||
         memcmp(rs->cmd_buf, rs->last_cmd_buf, rs->cmd_buf_size) != 0) {
-        for(i = 0; i < rs->last_cmd_buf_index; i++) {
+        for (i = 0; i < rs->last_cmd_buf_index; i++) {
             rs->printf_func(rs->opaque, "\033[D");
         }
         rs->cmd_buf[rs->cmd_buf_size] = '\0';
         if (rs->read_password) {
             len = strlen(rs->cmd_buf);
-            for(i = 0; i < len; i++)
+            for (i = 0; i < len; i++)
                 rs->printf_func(rs->opaque, "*");
         } else {
             rs->printf_func(rs->opaque, "%s", rs->cmd_buf);
@@ -67,12 +67,12 @@ static void readline_update(ReadLineState *rs)
     if (rs->cmd_buf_index != rs->last_cmd_buf_index) {
         delta = rs->cmd_buf_index - rs->last_cmd_buf_index;
         if (delta > 0) {
-            for(i = 0;i < delta; i++) {
+            for (i = 0; i < delta; i++) {
                 rs->printf_func(rs->opaque, "\033[C");
             }
         } else {
             delta = -delta;
-            for(i = 0;i < delta; i++) {
+            for (i = 0; i < delta; i++) {
                 rs->printf_func(rs->opaque, "\033[D");
             }
         }
@@ -301,7 +301,7 @@ static void readline_completion(ReadLineState *rs)
         return;
     if (rs->nb_completions == 1) {
         len = strlen(rs->completions[0]);
-        for(i = rs->completion_index; i < len; i++) {
+        for (i = rs->completion_index; i < len; i++) {
             readline_insert_char(rs, rs->completions[0][i]);
         }
         /* extra space for next argument. XXX: make it more generic */
@@ -312,15 +312,15 @@ static void readline_completion(ReadLineState *rs)
               completion_comp);
         rs->printf_func(rs->opaque, "\n");
         max_width = 0;
-        max_prefix = 0;	
-        for(i = 0; i < rs->nb_completions; i++) {
+        max_prefix = 0;
+        for (i = 0; i < rs->nb_completions; i++) {
             len = strlen(rs->completions[i]);
-            if (i==0) {
+            if (i == 0) {
                 max_prefix = len;
             } else {
                 if (len < max_prefix)
                     max_prefix = len;
-                for(j=0; j<max_prefix; j++) {
+                for (j = 0; j < max_prefix; j++) {
                     if (rs->completions[i][j] != rs->completions[0][j])
                         max_prefix = j;
                 }
@@ -328,8 +328,8 @@ static void readline_completion(ReadLineState *rs)
             if (len > max_width)
                 max_width = len;
         }
-        if (max_prefix > 0) 
-            for(i = rs->completion_index; i < max_prefix; i++) {
+        if (max_prefix > 0)
+            for (i = rs->completion_index; i < max_prefix; i++) {
                 readline_insert_char(rs, rs->completions[0][i]);
             }
         max_width += 2;
@@ -339,7 +339,7 @@ static void readline_completion(ReadLineState *rs)
             max_width = 80;
         nb_cols = 80 / max_width;
         j = 0;
-        for(i = 0; i < rs->nb_completions; i++) {
+        for (i = 0; i < rs->nb_completions; i++) {
             rs->printf_func(rs->opaque, "%-*s", max_width, rs->completions[i]);
             if (++j == nb_cols || i == (rs->nb_completions - 1)) {
                 rs->printf_func(rs->opaque, "\n");
@@ -362,9 +362,9 @@ static void readline_clear_screen(ReadLineState *rs)
 /* return true if command handled */
 void readline_handle_byte(ReadLineState *rs, int ch)
 {
-    switch(rs->esc_state) {
+    switch (rs->esc_state) {
     case IS_NORM:
-        switch(ch) {
+        switch (ch) {
         case 1:
             readline_bol(rs);
             break;
@@ -425,7 +425,7 @@ void readline_handle_byte(ReadLineState *rs, int ch)
         }
         break;
     case IS_CSI:
-        switch(ch) {
+        switch (ch) {
 	case 'A':
 	case 'F':
 	    readline_up_char(rs);
@@ -444,7 +444,7 @@ void readline_handle_byte(ReadLineState *rs, int ch)
             rs->esc_param = rs->esc_param * 10 + (ch - '0');
             goto the_end;
         case '~':
-            switch(rs->esc_param) {
+            switch (rs->esc_param) {
             case 1:
                 readline_bol(rs);
                 break;
@@ -463,7 +463,7 @@ void readline_handle_byte(ReadLineState *rs, int ch)
     the_end:
         break;
     case IS_SS3:
-        switch(ch) {
+        switch (ch) {
         case 'F':
             readline_eol(rs);
             break;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-trivial] [PATCH v2 2/2] util: readline: replace tab indent by four spaces to fix checkpatch errors
  2019-04-01  2:44 [Qemu-trivial] [PATCH v2 0/2] util/readline: errors clean-ups Jules Irenge
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool Jules Irenge
@ 2019-04-01  2:44 ` Jules Irenge
  2019-04-01  5:26   ` [Qemu-trivial] [Qemu-devel] " Thomas Huth
  2019-04-01  2:50 ` [Qemu-trivial] [Qemu-devel] [PATCH v2 0/2] util/readline: errors clean-ups no-reply
  2019-04-03 12:01 ` Stefan Hajnoczi
  3 siblings, 1 reply; 7+ messages in thread
From: Jules Irenge @ 2019-04-01  2:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

Replace tab indent by four spaces to fix errors issued by checkpatch.pl tool
"ERROR: code indent should never use tabs" within "util/readline.c" file.

Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
---
 util/readline.c | 98 ++++++++++++++++++++++++-------------------------
 1 file changed, 49 insertions(+), 49 deletions(-)

diff --git a/util/readline.c b/util/readline.c
index db399d3948..3eb5a66dfc 100644
--- a/util/readline.c
+++ b/util/readline.c
@@ -179,20 +179,20 @@ static void readline_up_char(ReadLineState *rs)
     int idx;
 
     if (rs->hist_entry == 0)
-	return;
+        return;
     if (rs->hist_entry == -1) {
-	/* Find latest entry */
-	for (idx = 0; idx < READLINE_MAX_CMDS; idx++) {
-	    if (rs->history[idx] == NULL)
-		break;
-	}
-	rs->hist_entry = idx;
+        /* Find latest entry */
+        for (idx = 0; idx < READLINE_MAX_CMDS; idx++) {
+            if (rs->history[idx] == NULL)
+                break;
+        }
+        rs->hist_entry = idx;
     }
     rs->hist_entry--;
     if (rs->hist_entry >= 0) {
-	pstrcpy(rs->cmd_buf, sizeof(rs->cmd_buf),
+        pstrcpy(rs->cmd_buf, sizeof(rs->cmd_buf),
                 rs->history[rs->hist_entry]);
-	rs->cmd_buf_index = rs->cmd_buf_size = strlen(rs->cmd_buf);
+        rs->cmd_buf_index = rs->cmd_buf_size = strlen(rs->cmd_buf);
     }
 }
 
@@ -202,11 +202,11 @@ static void readline_down_char(ReadLineState *rs)
         return;
     if (rs->hist_entry < READLINE_MAX_CMDS - 1 &&
         rs->history[++rs->hist_entry] != NULL) {
-	pstrcpy(rs->cmd_buf, sizeof(rs->cmd_buf),
+        pstrcpy(rs->cmd_buf, sizeof(rs->cmd_buf),
                 rs->history[rs->hist_entry]);
     } else {
         rs->cmd_buf[0] = 0;
-	rs->hist_entry = -1;
+        rs->hist_entry = -1;
     }
     rs->cmd_buf_index = rs->cmd_buf_size = strlen(rs->cmd_buf);
 }
@@ -217,42 +217,42 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline)
     int idx;
 
     if (cmdline[0] == '\0')
-	return;
+        return;
     new_entry = NULL;
     if (rs->hist_entry != -1) {
-	/* We were editing an existing history entry: replace it */
-	hist_entry = rs->history[rs->hist_entry];
-	idx = rs->hist_entry;
-	if (strcmp(hist_entry, cmdline) == 0) {
-	    goto same_entry;
-	}
+        /* We were editing an existing history entry: replace it */
+        hist_entry = rs->history[rs->hist_entry];
+        idx = rs->hist_entry;
+        if (strcmp(hist_entry, cmdline) == 0) {
+            goto same_entry;
+        }
     }
     /* Search cmdline in history buffers */
     for (idx = 0; idx < READLINE_MAX_CMDS; idx++) {
-	hist_entry = rs->history[idx];
-	if (hist_entry == NULL)
-	    break;
-	if (strcmp(hist_entry, cmdline) == 0) {
-	same_entry:
-	    new_entry = hist_entry;
-	    /* Put this entry at the end of history */
-	    memmove(&rs->history[idx], &rs->history[idx + 1],
-		    (READLINE_MAX_CMDS - (idx + 1)) * sizeof(char *));
-	    rs->history[READLINE_MAX_CMDS - 1] = NULL;
-	    for (; idx < READLINE_MAX_CMDS; idx++) {
-		if (rs->history[idx] == NULL)
-		    break;
-	    }
-	    break;
-	}
+        hist_entry = rs->history[idx];
+        if (hist_entry == NULL)
+            break;
+        if (strcmp(hist_entry, cmdline) == 0) {
+        same_entry:
+            new_entry = hist_entry;
+            /* Put this entry at the end of history */
+            memmove(&rs->history[idx], &rs->history[idx + 1],
+                    (READLINE_MAX_CMDS - (idx + 1)) * sizeof(char *));
+            rs->history[READLINE_MAX_CMDS - 1] = NULL;
+            for (; idx < READLINE_MAX_CMDS; idx++) {
+                if (rs->history[idx] == NULL)
+                    break;
+            }
+            break;
+        }
     }
     if (idx == READLINE_MAX_CMDS) {
-	/* Need to get one free slot */
+        /* Need to get one free slot */
         g_free(rs->history[0]);
-	memmove(rs->history, &rs->history[1],
-	        (READLINE_MAX_CMDS - 1) * sizeof(char *));
-	rs->history[READLINE_MAX_CMDS - 1] = NULL;
-	idx = READLINE_MAX_CMDS - 1;
+        memmove(rs->history, &rs->history[1],
+                (READLINE_MAX_CMDS - 1) * sizeof(char *));
+        rs->history[READLINE_MAX_CMDS - 1] = NULL;
+        idx = READLINE_MAX_CMDS - 1;
     }
     if (new_entry == NULL)
         new_entry = g_strdup(cmdline);
@@ -403,9 +403,9 @@ void readline_handle_byte(ReadLineState *rs, int ch)
         case 8:
             readline_backspace(rs);
             break;
-	case 155:
+        case 155:
             rs->esc_state = IS_CSI;
-	    break;
+            break;
         default:
             if (ch >= 32) {
                 readline_insert_char(rs, ch);
@@ -426,14 +426,14 @@ void readline_handle_byte(ReadLineState *rs, int ch)
         break;
     case IS_CSI:
         switch (ch) {
-	case 'A':
-	case 'F':
-	    readline_up_char(rs);
-	    break;
-	case 'B':
-	case 'E':
-	    readline_down_char(rs);
-	    break;
+        case 'A':
+        case 'F':
+            readline_up_char(rs);
+            break;
+        case 'B':
+        case 'E':
+            readline_down_char(rs);
+            break;
         case 'D':
             readline_backward_char(rs);
             break;
-- 
2.20.1



^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 0/2] util/readline: errors clean-ups
  2019-04-01  2:44 [Qemu-trivial] [PATCH v2 0/2] util/readline: errors clean-ups Jules Irenge
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool Jules Irenge
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 2/2] util: readline: replace tab indent by four spaces to fix checkpatch errors Jules Irenge
@ 2019-04-01  2:50 ` no-reply
  2019-04-03 12:01 ` Stefan Hajnoczi
  3 siblings, 0 replies; 7+ messages in thread
From: no-reply @ 2019-04-01  2:50 UTC (permalink / raw)
  To: jbi.octave; +Cc: fam, qemu-devel, qemu-trivial

Patchew URL: https://patchew.org/QEMU/20190401024406.10819-1-jbi.octave@gmail.com/



Hi,

This series seems to have some coding style problems. See output below for
more information:

Message-id: 20190401024406.10819-1-jbi.octave@gmail.com
Subject: [Qemu-devel] [PATCH v2 0/2] util/readline: errors clean-ups
Type: series

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
 * [new tag]               patchew/20190401024406.10819-1-jbi.octave@gmail.com -> patchew/20190401024406.10819-1-jbi.octave@gmail.com
 * [new tag]               patchew/87y34v42z0.fsf_-_@dusky.pond.sub.org -> patchew/87y34v42z0.fsf_-_@dusky.pond.sub.org
Switched to a new branch 'test'
2e75b209af util: readline: replace tab indent by four spaces to fix checkpatch errors
d797524276 util/readline: add a space to fix errors by checkpatch tool

=== OUTPUT BEGIN ===
1/2 Checking commit d79752427670 (util/readline: add a space to fix errors by checkpatch tool)
ERROR: braces {} are necessary for all arms of this statement
#31: FILE: util/readline.c:57:
+            for (i = 0; i < len; i++)
[...]

total: 1 errors, 0 warnings, 109 lines checked

Patch 1/2 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

2/2 Checking commit 2e75b209af4f (util: readline: replace tab indent by four spaces to fix checkpatch errors)
ERROR: braces {} are necessary for all arms of this statement
#32: FILE: util/readline.c:186:
+            if (rs->history[idx] == NULL)
[...]

ERROR: braces {} are necessary for all arms of this statement
#101: FILE: util/readline.c:233:
+        if (hist_entry == NULL)
[...]

ERROR: braces {} are necessary for all arms of this statement
#111: FILE: util/readline.c:243:
+                if (rs->history[idx] == NULL)
[...]

total: 3 errors, 0 warnings, 145 lines checked

Patch 2/2 has style problems, please review.  If any of these errors
are false positives report them to the maintainer, see
CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1


The full log is available at
http://patchew.org/logs/20190401024406.10819-1-jbi.octave@gmail.com/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to patchew-devel@redhat.com

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool Jules Irenge
@ 2019-04-01  5:23   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2019-04-01  5:23 UTC (permalink / raw)
  To: Jules Irenge, qemu-devel; +Cc: qemu-trivial, Stefan Hajnoczi

On 01/04/2019 04.44, Jules Irenge wrote:
> util/readline: add a space to fix errors reported by checkpatch.pl tool
> "ERROR: space required before the open parenthesis"
> "ERROR: space required after that ..."
> within "util/redline.c" file
> 
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  util/readline.c | 34 +++++++++++++++++-----------------
>  1 file changed, 17 insertions(+), 17 deletions(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 2/2] util: readline: replace tab indent by four spaces to fix checkpatch errors
  2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 2/2] util: readline: replace tab indent by four spaces to fix checkpatch errors Jules Irenge
@ 2019-04-01  5:26   ` Thomas Huth
  0 siblings, 0 replies; 7+ messages in thread
From: Thomas Huth @ 2019-04-01  5:26 UTC (permalink / raw)
  To: Jules Irenge, qemu-devel; +Cc: qemu-trivial

On 01/04/2019 04.44, Jules Irenge wrote:
> Replace tab indent by four spaces to fix errors issued by checkpatch.pl tool
> "ERROR: code indent should never use tabs" within "util/readline.c" file.
> 
> Signed-off-by: Jules Irenge <jbi.octave@gmail.com>
> ---
>  util/readline.c | 98 ++++++++++++++++++++++++-------------------------
>  1 file changed, 49 insertions(+), 49 deletions(-)
Reviewed-by: Thomas Huth <thuth@redhat.com>


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Qemu-trivial] [Qemu-devel] [PATCH v2 0/2] util/readline: errors clean-ups
  2019-04-01  2:44 [Qemu-trivial] [PATCH v2 0/2] util/readline: errors clean-ups Jules Irenge
                   ` (2 preceding siblings ...)
  2019-04-01  2:50 ` [Qemu-trivial] [Qemu-devel] [PATCH v2 0/2] util/readline: errors clean-ups no-reply
@ 2019-04-03 12:01 ` Stefan Hajnoczi
  3 siblings, 0 replies; 7+ messages in thread
From: Stefan Hajnoczi @ 2019-04-03 12:01 UTC (permalink / raw)
  To: Jules Irenge; +Cc: qemu-devel, qemu-trivial

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

On Mon, Apr 01, 2019 at 03:44:04AM +0100, Jules Irenge wrote:
> This v2 version combines two fix of errors into one  and replace tab
> indent by four spaces
> 
> Jules Irenge (2):
>   util/readline: add a space to fix errors by checkpatch tool
>   util: readline: replace tab indent by four spaces to fix checkpatch
>     errors
> 
>  util/readline.c | 132 ++++++++++++++++++++++++------------------------
>  1 file changed, 66 insertions(+), 66 deletions(-)

This file is unmaintained, I'll take this patch through my tree.

Thanks, applied to my block-next tree:
https://github.com/stefanha/qemu/commits/block-next

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-03 12:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-01  2:44 [Qemu-trivial] [PATCH v2 0/2] util/readline: errors clean-ups Jules Irenge
2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 1/2] util/readline: add a space to fix errors by checkpatch tool Jules Irenge
2019-04-01  5:23   ` [Qemu-trivial] [Qemu-devel] " Thomas Huth
2019-04-01  2:44 ` [Qemu-trivial] [PATCH v2 2/2] util: readline: replace tab indent by four spaces to fix checkpatch errors Jules Irenge
2019-04-01  5:26   ` [Qemu-trivial] [Qemu-devel] " Thomas Huth
2019-04-01  2:50 ` [Qemu-trivial] [Qemu-devel] [PATCH v2 0/2] util/readline: errors clean-ups no-reply
2019-04-03 12:01 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).