From nobody Fri Apr 19 23:11:41 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VLr4Y31sMz5Hwmp; Fri, 19 Apr 2024 23:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VLr4Y1VNbz4Rwb; Fri, 19 Apr 2024 23:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713568301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vCV9keSt2pV498SSeUNZOUKQl3bkZE/pPfKXdaUiYCE=; b=SwzteUG/SKp9C7SgLfqljehdYhibCrmBVf1qMw+ChdDeXhfNPPDGY3iRbteJPQJ9Z2ZSiw 8oR9wQoLHGaqNdljjDeIl3UMTu/gMavEbHIUCdPYbmAAWsLDjx4AUc/KwxftSJwuc9zkr/ L+/UFLKrHsRDDeOacB3Q9F9fZVQRdIM9czvkeFiJOIKHEQ+JrzT/3YcMX6Hz/pEr4vFeu7 /9yXOCZi8ralyoTvGEkDtomfMcSKHdKRSoC6y4nRyKBWBy+CTyMrN/pcXTeXEE5lSBnArp JDLqLI6HhFc9qOsESvYwSBJ4CKgjItjW5QbSOnye0aM/yRJXJ9pW8FeSCyMGTA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1713568301; a=rsa-sha256; cv=none; b=niiq1nU1KWl6JuRHPhtJAgE8dHfQIqa5Qh2gSgcXu9M3xqw4pMuN7fW+WbdHMdC/LinfbK XlAhpCib5lltowG/2S5cyk5azaZ+xrllCExWJ7xjk+zhYH4Lju7pdR6hWZVcs2K42IC4VF 1eFWfodkVsBo6q6Es3xP4+CmJ90J8YQrcnORALw6DFheXNlTQ4yFw9iB1JV/lNvUsOedY7 qscmHnADR7ZFiAw7i/xQ5/rPwvB10X26K8lt/NQzTo2XF/cULD3QMwCHBNp+wnVKRjUKQn Q9vaXyeFaTWnOOHfmi2Iwa7r1DzJlRMizoSaJKm8jUTB9miNedgt3csO8ysd9g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1713568301; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=vCV9keSt2pV498SSeUNZOUKQl3bkZE/pPfKXdaUiYCE=; b=ktqqi4ynj437jSemkQCdb5yt4aPqKUJc7kZ8umkOv7J22aLeUgNLmmA62r8XkIBzN26m8L DJNglTf0loUi/0lLW36xjOdjB6yXpPucr6A+uSBfBd4EhEcYcbPdUb2K8HIPMXA2VyAXPv qwQuY9E6tOyihm7pZetJyO6RNKttr0dCeGqrvLwSnoa3gr7lWaln8zNOJ4QuYd8NLgOxLn cQoy4ZER90vqWMl8cHynHkB/6z8eVG6jx0TlKdFTQK/qoC5mrWqp1tGgdSmxg3h/MpEfSU od/4sRnqfDDByUbH55L8b9CGi3D98JaZ4tKIY91yaYRU6XbCygjaND26b7VZPQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VLr4Y16cHz1BXd; Fri, 19 Apr 2024 23:11:41 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 43JNBf3U059451; Fri, 19 Apr 2024 23:11:41 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 43JNBfbB059446; Fri, 19 Apr 2024 23:11:41 GMT (envelope-from git) Date: Fri, 19 Apr 2024 23:11:41 GMT Message-Id: <202404192311.43JNBfbB059446@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 0bdcfb08f2d5 - main - usr.bin/units: use else..if to avoid calling the next branch List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 0bdcfb08f2d5b80523275adcdd64facb102eedbc Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=0bdcfb08f2d5b80523275adcdd64facb102eedbc commit 0bdcfb08f2d5b80523275adcdd64facb102eedbc Author: rilysh AuthorDate: 2024-04-19 22:53:05 +0000 Commit: Warner Losh CommitDate: 2024-04-19 22:54:30 +0000 usr.bin/units: use else..if to avoid calling the next branch Even if the first branch succeeds, next time it will still check for the second branch (which will be false) as the first one was true. Add an else..if statement to address this. Signed-off-by: rilysh Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1165 --- usr.bin/units/units.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index 78b7e4020ed3..1b6d0ed90b4a 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -497,8 +497,7 @@ lookupunit(const char *unit) } } free(copy); - } - if (unit[strlen(unit) - 1] == 's') { + } else if (unit[strlen(unit) - 1] == 's') { copy = dupstr(unit); copy[strlen(copy) - 1] = 0; for (i = 0; i < unitcount; i++) {