From nobody Sat May 13 20:06:04 2023 X-Original-To: dev-commits-src-all@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 4QJc8D6VMDz4Bk8c; Sat, 13 May 2023 20:06:04 +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 4QJc8D5TwTz3rxJ; Sat, 13 May 2023 20:06:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684008364; 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=/XqSLmCyRLiGWQGS4hYFNkroDdkidH8NoDpRVd857g0=; b=lEBCpgdn3abtNQNQfqAS/j39ZFZSElutGyQBlWgHKC4OKVOIWdxS/Eze5L9VnqtXHTDc9n xbvjTAcYeQW+oa70C5efvifXVHAAZCOsu9v7ndP95HaOQxyhjgBgXa2t1M+wnjosjtP0Gw 9TqY4a12cOqhL+TQVmP/wqrvVOl+PMZUYnGkd1yTcFMKLhw5uHIDmSUuGDk/jBlODy+aNc iFKf7QOhVPV6RuqFfH45vRWei0srLVvwtUW17T5EPswD0uZYFkinD80ZkeSZPmSCmIVqAd 1JziwOZF6QxoHJvsXl62ei7E/GXxILmOB0YOTrwSKZK1EhPXCKHwfdnLaClcHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1684008364; 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=/XqSLmCyRLiGWQGS4hYFNkroDdkidH8NoDpRVd857g0=; b=X4mqd0GkJbw79+nmr7eZvfKVTZ8ZSBWfuB4lYHQc0cVBJMuknd4eig9YE0XwFMUIrnTt0W GeC/DHuUTeLJMGVz0RT+38V3r0KPgORS/J0f53IFWjKfmk79vT+7FbjYvGAsV3MHlB0imU V9c8R2jdaraG3j8nFxHtIoEYRyeMzSghBwO3UBoj9VA+1d1GVzUNWhaJwYGguwz85zKjfb c/6tAVd6BeIA7p9/GTUSNdC/nPx81Z0HiRTkDaw4E45Xqh6w+kKXszP3c5fgB4iPTtNZJi fBaNg+2jdySj/zLeP4yVVe+wd4H8xsi0fJY0CvoR1ZyLPOScmL7S0qmYftsxwg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1684008364; a=rsa-sha256; cv=none; b=A3Pe5rMZDPASTdmKBrsadkFixeTD3HDJUVdisAJkl1XWstr0LmHP9ScYS07UL8Q7Yheg59 k+31mANKKNO7sA+9Punc0pFQ+fKgG8x4ngJAQeR13WAnhp8kYSZD+9o8/5PnvIH7Vy4x5J zGz/+ifRD9vYXeAzNAUAC4LxfH13q96cI2Vd3Lc5znGScqnDU5TAY4f+Qh50KlDOCifJuD +pYan6DLUh1ot0XgqN/FjU0rHIu1YFhQfhtJReDJQe9X1CilrMrsMAktOyyF1lIs9WJoTP P4QBY8lezPeZMuVLO/sdsBkSXRwlNHZuCkZwmCPuV9Yy31grvj39TuRLYESfOg== 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 4QJc8D4YzkzW7s; Sat, 13 May 2023 20:06:04 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 34DK64DK060769; Sat, 13 May 2023 20:06:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 34DK64D3060768; Sat, 13 May 2023 20:06:04 GMT (envelope-from git) Date: Sat, 13 May 2023 20:06:04 GMT Message-Id: <202305132006.34DK64D3060768@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Piotr Pawel Stefaniak Subject: git: 43489c142e56 - main - sh: improve style List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: pstef X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 43489c142e5686ef92b632afa847f4aa4ce8a526 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by pstef: URL: https://cgit.FreeBSD.org/src/commit/?id=43489c142e5686ef92b632afa847f4aa4ce8a526 commit 43489c142e5686ef92b632afa847f4aa4ce8a526 Author: Piotr Pawel Stefaniak AuthorDate: 2023-04-29 20:42:15 +0000 Commit: Piotr Pawel Stefaniak CommitDate: 2023-05-13 19:57:27 +0000 sh: improve style --- bin/sh/histedit.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/bin/sh/histedit.c b/bin/sh/histedit.c index db3b8bcfc1da..07a344ebd17b 100644 --- a/bin/sh/histedit.c +++ b/bin/sh/histedit.c @@ -589,15 +589,16 @@ static int comparator(const void *a, const void *b, void *thunk) { size_t curpos = (intptr_t)thunk; + return (strcmp(*(char *const *)a + curpos, *(char *const *)b + curpos)); } /* - * This function is passed to libedit's fn_complete2(). The library will - * use it instead of its standard function that finds matching files in - * current directory. If we're at the start of the line, we want to look - * for available commands from all paths in $PATH. + * This function is passed to libedit's fn_complete2(). The library will use + * it instead of its standard function that finds matching files in current + * directory. If we're at the start of the line, we want to look for + * available commands from all paths in $PATH. */ static char **sh_matches(const char *text, int start, int end) @@ -681,13 +682,13 @@ out: } matches[uniq + 1] = NULL; /* - * matches[0] is special: it's not a real matching file name but a common - * prefix for all matching names. It can't be null, unlike any other - * element of the array. When strings matches[0] and matches[1] compare - * equal and matches[2] is null that means to libedit that there is only - * a single match. It will then replace user input with possibly escaped - * string in matches[0] which is the reason to copy the full name of the - * only match. + * matches[0] is special: it's not a real matching file name but + * a common prefix for all matching names. It can't be null, unlike + * any other element of the array. When strings matches[0] and + * matches[1] compare equal and matches[2] is null that means to + * libedit that there is only a single match. It will then replace + * user input with possibly escaped string in matches[0] which is the + * reason to copy the full name of the only match. */ if (uniq == 1) matches[0] = strdup(matches[1]);