Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1nzNFG-000855-K3 for mharc-grub-devel@gnu.org; Thu, 09 Jun 2022 14:51:02 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46568) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzNF1-0007yO-RK for grub-devel@gnu.org; Thu, 09 Jun 2022 14:50:50 -0400 Received: from mail.efficios.com ([167.114.26.124]:43254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nzNEu-0000X4-LU for grub-devel@gnu.org; Thu, 09 Jun 2022 14:50:47 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id B8447412E0C; Thu, 9 Jun 2022 14:50:31 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id RolsVqfLVjaF; Thu, 9 Jun 2022 14:50:31 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 7C94C412E8C; Thu, 9 Jun 2022 14:50:30 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 7C94C412E8C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1654800630; bh=fdrXDouUNFVY1wU+SryrbOvXL1eCdaTITEtVygutAvg=; h=From:To:Date:Message-Id:MIME-Version; b=Q/iCiIMf6WMcCHUvcnnBGnao8cFr3VtpMj9tHwou/yYz9//kLMBiqrChbXJVXKfYG nuhDtOb6iM2j88B4Eyb2OQJ6AavKGeLIId6MfZS5l8bDhA5pGfnMYR0zAViPJs0sWG OzfQL/RcOPQxZc2hkLO7jc/Vld05Cs+VrFenwf7oedS99XOJn0FXxNNSWyj3j1bghg PwiyhyQUBgyUb92P4laxUiAAA67ibDJYUK2eHFc2MJOmonVwoBgBJkuJ1LIlf7anEU PHbo99HDF5C4i/a5UWx8/zIInk6S+yERkOgzdA9P2IToFXUkeyTVTnQAxO5k8/yQsV 5Ff5tpuzHglmw== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id vSVxZpw6RigL; Thu, 9 Jun 2022 14:50:30 -0400 (EDT) Received: from thinkos.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by mail.efficios.com (Postfix) with ESMTPSA id EBF294128F4; Thu, 9 Jun 2022 14:50:27 -0400 (EDT) From: Mathieu Desnoyers To: grub-devel@gnu.org, Daniel Kiper Cc: Mathieu Desnoyers , Robbie Harwood Subject: [PATCH v5 5/5] Cleanup: grub-mkconfig_lib: remove unused version comparison functions Date: Thu, 9 Jun 2022 14:50:24 -0400 Message-Id: <20220609185024.447922-6-mathieu.desnoyers@efficios.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220609185024.447922-1-mathieu.desnoyers@efficios.com> References: <20220609185024.447922-1-mathieu.desnoyers@efficios.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=167.114.26.124; envelope-from=mathieu.desnoyers@efficios.com; helo=mail.efficios.com X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 09 Jun 2022 18:50:51 -0000 There are no users left of version_find_latest(), version_test_gt(), and version_test_numeric(). Remove those unused helper functions. Using those helper functions is what caused the quadratic sorting performance issues in the first place, so removing them is a net win. Signed-off-by: Mathieu Desnoyers Reviewed-by: Robbie Harwood --- util/grub-mkconfig_lib.in | 51 --------------------------------------- 1 file changed, 51 deletions(-) diff --git a/util/grub-mkconfig_lib.in b/util/grub-mkconfig_lib.in index fc14afdb3..de1bb5310 100644 --- a/util/grub-mkconfig_lib.in +++ b/util/grub-mkconfig_lib.in @@ -218,57 +218,6 @@ version_sort () esac } =20 -version_test_numeric () -{ - version_test_numeric_a=3D"$1" - version_test_numeric_cmp=3D"$2" - version_test_numeric_b=3D"$3" - if [ "$version_test_numeric_a" =3D "$version_test_numeric_b" ] ; then - case "$version_test_numeric_cmp" in - ge|eq|le) return 0 ;; - gt|lt) return 1 ;; - esac - fi - if [ "$version_test_numeric_cmp" =3D "lt" ] ; then - version_test_numeric_c=3D"$version_test_numeric_a" - version_test_numeric_a=3D"$version_test_numeric_b" - version_test_numeric_b=3D"$version_test_numeric_c" - fi - if (echo "$version_test_numeric_a" ; echo "$version_test_numeric_b") |= version_sort | head -n 1 | grep -qx "$version_test_numeric_b" ; then - return 0 - else - return 1 - fi -} - -version_test_gt () -{ - version_test_gt_a=3D"`echo "$1" | sed -e "s/[^-]*-//"`" - version_test_gt_b=3D"`echo "$2" | sed -e "s/[^-]*-//"`" - version_test_gt_cmp=3Dgt - if [ "x$version_test_gt_b" =3D "x" ] ; then - return 0 - fi - case "$version_test_gt_a:$version_test_gt_b" in - *.old:*.old) ;; - *.old:*) version_test_gt_a=3D"`echo "$version_test_gt_a" | sed -e 's= /\.old$//'`" ; version_test_gt_cmp=3Dgt ;; - *:*.old) version_test_gt_b=3D"`echo "$version_test_gt_b" | sed -e 's= /\.old$//'`" ; version_test_gt_cmp=3Dge ;; - esac - version_test_numeric "$version_test_gt_a" "$version_test_gt_cmp" "$ver= sion_test_gt_b" - return "$?" -} - -version_find_latest () -{ - version_find_latest_a=3D"" - for i in "$@" ; do - if version_test_gt "$i" "$version_find_latest_a" ; then - version_find_latest_a=3D"$i" - fi - done - echo "$version_find_latest_a" -} - # One layer of quotation is eaten by "" and the second by sed; so this t= urns # ' into \'. grub_quote () { --=20 2.30.2