util/readline: add a space to fix errors by checkpatch tool

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>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Message-id: 20190401024406.10819-2-jbi.octave@gmail.com
Message-Id: <20190401024406.10819-2-jbi.octave@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Jules Irenge 2019-04-01 03:44:05 +01:00 committed by Stefan Hajnoczi
parent 812b835fb4
commit 2467f95ab3

View File

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