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 BE0DBA034C; Wed, 9 Nov 2022 20:53:47 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D13D3410E7; Wed, 9 Nov 2022 20:53:39 +0100 (CET) Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mails.dpdk.org (Postfix) with ESMTP id 942A540150 for ; Wed, 9 Nov 2022 20:53:38 +0100 (CET) Received: by mail-pl1-f172.google.com with SMTP id d20so17013798plr.10 for ; Wed, 09 Nov 2022 11:53:38 -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=fkvice1uZC16ljXvnhDIqIejiYk/cI6wS7NVqtH4oMg=; b=qtviwTGr/dKYPoGG7eMMb5+A53IpA5CdWJypM2JshWwhqaAF3jqVz+ImZBe6ULt7EM 2O3Xtyt8P8baoC5wU7GeYOQPI9hiRJCBVPMu0jFKhLS9Clw+UhugWAxoGsg40xTN+gq4 Kf6lHElwXpWKRlBndsyD/KSgHr+2JRRKu9ImwREJGwn7USGzgU6Pjqr5mnrGJjWSuGG3 19HyfNfQy3pgdVBg4pcAU1rMWO075voUZxw5Ej1JavVuIwiIN/Z2TMGnVjPj4Q/8sUxr XQaa5EeavP+EYVUYJLxxRYUBG66y3GhvWhmmwOVa37E13aqlTEpYdCjuVZgtH4ucPQXa O+gQ== 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=fkvice1uZC16ljXvnhDIqIejiYk/cI6wS7NVqtH4oMg=; b=ce2+9P/tPaNZM5owhGzL8ffUVJYySRhAFvC+oXYflhEVxRr3lWZjYOTdPXJhme4s+5 q7yNLavf+VUNixBUGlQNrV07VxpzjKKGgFMYUJtvPG9WgW60VKwbYLku/EPFWt39dxdW dsfUvqwUhEn216WUdMuCKeoj2bzk96FBeeY7/5TxkJ+cq+3bN0vpG6Z0pYH+3dzBTXQn 5tCA9zzDcmIGFRWAVijjK/oKRpgu5856aoA7WS3ZY1wD0pOzsRngq0nxqAbWtvLIE68b ESLcS92hAOEQOl5MroJ9vo2uRog1LJBkLR7NE1/dcB4IYnvtTmIX0q5K+ctLQ1K3DDGC V9AA== X-Gm-Message-State: ACrzQf32gjlpMTF/Ga9dv0t9oY/vvmwrJo0QTekdEH9lxieO+D5svGEH C5zmcsponHxkaBPBbxHW9kYt9TYWH3PtfQ== X-Google-Smtp-Source: AMsMyM7dPmy0Lt+PVEkeA9RQxC6RC6BEVMyOLcl0nCtxy3upfTFZyi1yHRQgnhWT5X3fo++6wveoXg== X-Received: by 2002:a17:903:2452:b0:186:99e0:672d with SMTP id l18-20020a170903245200b0018699e0672dmr62936966pls.95.1668023617459; Wed, 09 Nov 2022 11:53:37 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id u14-20020a170902e5ce00b0017f778d4543sm9628875plf.241.2022.11.09.11.53.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Nov 2022 11:53:36 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger , Olivier Matz Subject: [PATCH v2 02/14] cmdline: fix whitespace Date: Wed, 9 Nov 2022 11:53:19 -0800 Message-Id: <20221109195331.143473-3-stephen@networkplumber.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221109195331.143473-1-stephen@networkplumber.org> References: <20221109191445.140320-1-stephen@networkplumber.org> <20221109195331.143473-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 | 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