DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Olivier Matz <olivier.matz@6wind.com>
Subject: [PATCH v2 02/14] cmdline: fix whitespace
Date: Wed,  9 Nov 2022 11:53:19 -0800	[thread overview]
Message-ID: <20221109195331.143473-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20221109195331.143473-1-stephen@networkplumber.org>

Add space after keywords.
Remove unnecessary spaces in if expressions.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/cmdline/cmdline_parse_string.c | 16 +++++++---------
 lib/cmdline/cmdline_rdline.c       | 12 ++++++------
 2 files changed, 13 insertions(+), 15 deletions(-)

diff --git a/lib/cmdline/cmdline_parse_string.c b/lib/cmdline/cmdline_parse_string.c
index d756638905a2..ab1ef4b22e40 100644
--- a/lib/cmdline/cmdline_parse_string.c
+++ b/lib/cmdline/cmdline_parse_string.c
@@ -73,20 +73,18 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 			token_len = get_token_len(str);
 
 			/* if token is too big... */
-			if (token_len >= STR_TOKEN_SIZE - 1) {
+			if (token_len >= STR_TOKEN_SIZE - 1)
 				continue;
 			}
 
-			if ( strncmp(buf, str, token_len) ) {
+			if (strncmp(buf, str, token_len))
 				continue;
-			}
 
-			if ( !cmdline_isendoftoken(*(buf+token_len)) ) {
+			if (!cmdline_isendoftoken(*(buf+token_len)))
 				continue;
-			}
 
 			break;
-		} while ( (str = get_next_token(str)) != NULL );
+		} while ((str = get_next_token(str)) != NULL);
 
 		if (!str)
 			return -1;
@@ -108,7 +106,7 @@ cmdline_parse_string(cmdline_parse_token_hdr_t *tk, const char *buf, void *res,
 	/* unspecified string (unknown single token) */
 	else {
 		token_len = 0;
-		while(!cmdline_isendoftoken(buf[token_len]) &&
+		while (!cmdline_isendoftoken(buf[token_len]) &&
 		      token_len < (STR_TOKEN_SIZE-1))
 			token_len++;
 
@@ -149,9 +147,9 @@ int cmdline_complete_get_nb_string(cmdline_parse_token_hdr_t *tk)
 		return 0;
 
 	str = sd->str;
-	while( (str = get_next_token(str)) != NULL ) {
+	while ((str = get_next_token(str)) != NULL)
 		ret++;
-	}
+
 	return ret;
 }
 
diff --git a/lib/cmdline/cmdline_rdline.c b/lib/cmdline/cmdline_rdline.c
index 5cf723a0126a..b5927879d48f 100644
--- a/lib/cmdline/cmdline_rdline.c
+++ b/lib/cmdline/cmdline_rdline.c
@@ -301,7 +301,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* delete 1 char from the left */
 		case CMDLINE_KEY_BKSPACE:
 		case CMDLINE_KEY_BKSPACE2:
-			if(!cirbuf_del_tail_safe(&rdl->left)) {
+			if (!cirbuf_del_tail_safe(&rdl->left)) {
 				rdline_puts(rdl, vt100_bs);
 				display_right_buffer(rdl, 1);
 			}
@@ -354,7 +354,7 @@ rdline_char_in(struct rdline *rdl, char c)
 		/* paste contents of kill buffer to the left side of caret */
 		case CMDLINE_KEY_CTRL_Y:
 			i=0;
-			while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
+			while (CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
 			      RDLINE_BUF_SIZE &&
 			      i < rdl->kill_size) {
 				cirbuf_add_tail(&rdl->left, rdl->kill_buf[i]);
@@ -403,10 +403,10 @@ rdline_char_in(struct rdline *rdl, char c)
 				tmp_size = strnlen(tmp_buf, sizeof(tmp_buf));
 				/* add chars */
 				if (ret == RDLINE_RES_COMPLETE) {
-					i=0;
-					while(CIRBUF_GET_LEN(&rdl->right) + CIRBUF_GET_LEN(&rdl->left) <
-					      RDLINE_BUF_SIZE &&
-					      i < tmp_size) {
+					i = 0;
+					while (CIRBUF_GET_LEN(&rdl->right) +
+					       CIRBUF_GET_LEN(&rdl->left) <
+					       RDLINE_BUF_SIZE && i < tmp_size) {
 						cirbuf_add_tail(&rdl->left, tmp_buf[i]);
 						rdl->write_char(rdl, tmp_buf[i]);
 						i++;
-- 
2.35.1


  parent reply	other threads:[~2022-11-09 19:53 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-09 19:14 [PATCH 00/14] whitespace around keywords Stephen Hemminger
2022-11-09 19:14 ` [PATCH 01/14] eal: fix whitespace Stephen Hemminger
2022-11-09 19:14 ` [PATCH 02/14] cmdline: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 03/14] timer: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 04/14] ip_frag: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 05/14] testpmd: fix whitspace Stephen Hemminger
2022-11-09 19:14 ` [PATCH 06/14] test: fix whitespace Stephen Hemminger
2022-11-09 19:14 ` [PATCH 07/14] examples/qos_sched: " Stephen Hemminger
2022-11-09 19:28   ` Dumitrescu, Cristian
2022-11-09 19:14 ` [PATCH 08/14] examples/vhost: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 09/14] l3fwd: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 10/14] examples: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 11/14] bus/pci: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 12/14] net/e1000: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 13/14] net/i40e: " Stephen Hemminger
2022-11-09 19:14 ` [PATCH 14/14] net/bnx2x: " Stephen Hemminger
2022-11-09 19:53 ` [PATCH v2 00/14] whitespace after keywords Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 01/14] eal: fix whitespace Stephen Hemminger
2022-11-09 19:53   ` Stephen Hemminger [this message]
2022-11-09 19:53   ` [PATCH v2 03/14] timer: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 04/14] ip_frag: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 05/14] testpmd: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 06/14] test: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 07/14] examples/qos_sched: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 08/14] examples/vhost: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 09/14] l3fwd: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 10/14] examples: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 11/14] bus/pci: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 12/14] net/e1000: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 13/14] net/i40e: " Stephen Hemminger
2022-11-09 19:53   ` [PATCH v2 14/14] net/bnx2x: " Stephen Hemminger
2022-11-09 23:24 ` [PATCH v3 00/14] whitespace after keywords Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 01/14] eal: fix whitespace Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 02/14] cmdline: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 03/14] timer: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 04/14] ip_frag: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 05/14] testpmd: " Stephen Hemminger
2022-11-11  6:30     ` Zhang, Yuying
2022-11-11  7:12       ` Zhang, Yuying
2022-11-09 23:24   ` [PATCH v3 06/14] test: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 07/14] examples/qos_sched: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 08/14] examples/vhost: " Stephen Hemminger
2022-11-10  1:48     ` Xia, Chenbo
2022-11-09 23:24   ` [PATCH v3 09/14] l3fwd: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 10/14] examples: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 11/14] bus/pci: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 12/14] net/e1000: " Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 13/14] net/i40e: " Stephen Hemminger
2022-11-11  6:23     ` Zhang, Yuying
2022-11-11  7:12       ` Zhang, Yuying
2022-11-11 16:48       ` Stephen Hemminger
2022-11-09 23:24   ` [PATCH v3 14/14] net/bnx2x: " Stephen Hemminger

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=20221109195331.143473-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.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;
as well as URLs for NNTP newsgroup(s).