From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9BE6EA0093; Thu, 10 Nov 2022 00:25:06 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 955F7410EF; Thu, 10 Nov 2022 00:24:59 +0100 (CET) Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com [209.85.215.169]) by mails.dpdk.org (Postfix) with ESMTP id 3C886410E6 for ; Thu, 10 Nov 2022 00:24:58 +0100 (CET) Received: by mail-pg1-f169.google.com with SMTP id f63so83106pgc.2 for ; Wed, 09 Nov 2022 15:24:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IiZjGh6EYGuTuV9xZk6AoXRTZxfa+uP6Q3936gc9mD8=; b=eWqyprCJ2hvdq1eqY4+3cGnQQbcovrgmL1+NmHWw8eO5Ht8vqPpOVHQ6cS4wuLwvE1 NqqkJZuarHaE9Vm2VmAEls1K3kP1FvDEC4YK06NTOLtCVGYUiIu0PHUzh5E/64ksAgoN 67xzkcEZIVyI4JP4Jkuab2+X9y5+oaMKQeKKRqLh9ObEP2jKhKliAC06Ut/TNEuRH56I eG/nLBjJjfsH1QUF5PjPLKNUkMaoa4lzPCdb7ggdFEM5z4FIdVqjaQ35xQLX5St1xWDd Mb2NP6ilkuTpWKSKgagi+HHKUk9+Zn28Rg9C3Fg30ZnHmOzBXG97yMv9i/ZTkfWIjQNV WCnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IiZjGh6EYGuTuV9xZk6AoXRTZxfa+uP6Q3936gc9mD8=; b=dvRZFxcRslytni+RI/8u7nLOvuJ/057aN3pFyE4tvAvvPGIu+eU8IpF9xQj1cXMWye JJcoAjLrU+jva4qL6eiFvzxYk1MHXWI8BgpPJs32nIFOFcn9xvoxCebrWs/MtFVa1vKi kyMGJeYukjdJMMkE0sYo6A+y6MqYqBDSUVxZH1AZuenwuTbBOQEx1oRtu2+vvzB+EvBL lVVkpO93e/bbt1DXcdiWKVf7Dg5wcq8pJ3phhaF6TK+LyOAuMViv7XMiPz7nonZ/HBzh viS19iFfOV1rpMWkT0/nDpe8+HEsTTSmDFEAJhI0mRCanuo2TNunqV619tgM/72UhpS2 pV1Q== X-Gm-Message-State: ACrzQf0ZT7sdcj7VW2Zmc01H8oFzBUMotxvPfeCsERbHbpCbhqiaZNxz m2e6r9W0y48dgyiVDyg8QFMij5LNeZ6dcg== X-Google-Smtp-Source: AMsMyM444SaT9/gSLlTVtj6KY+c+WPpkFtYgwiTWQE7v64aqyDYen9JKf5eRzw8ykx1g/gC6pd53wA== X-Received: by 2002:a65:42c8:0:b0:41a:8138:f47f with SMTP id l8-20020a6542c8000000b0041a8138f47fmr54127446pgp.476.1668036297118; Wed, 09 Nov 2022 15:24:57 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id y28-20020aa79e1c000000b0056e15b7138esm8798645pfq.157.2022.11.09.15.24.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 15:24:56 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Olivier Matz Subject: [PATCH v3 02/14] cmdline: fix whitespace Date: Wed, 9 Nov 2022 15:24:39 -0800 Message-Id: <20221109232451.265059-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109232451.265059-1-stephen@networkplumber.org> References: <20221109191445.140320-1-stephen@networkplumber.org> <20221109232451.265059-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Add space after keywords. Remove unnecessary spaces in if expressions. Signed-off-by: Stephen Hemminger --- lib/cmdline/cmdline_parse_string.c | 17 +++++++---------- lib/cmdline/cmdline_rdline.c | 12 ++++++------ 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/lib/cmdline/cmdline_parse_string.c b/lib/cmdline/cmdline_parse_string.c index d756638905a2..4224983d2e73 100644 --- a/lib/cmdline/cmdline_parse_string.c +++ b/lib/cmdline/cmdline_parse_string.c @@ -73,20 +73,17 @@ 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 +105,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 +146,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