Gentoo Archives: gentoo-dev

From: "Ulrich Müller" <ulm@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] [PATCH] estack.eclass: Drop isdigit function.
Date: Sat, 23 Nov 2019 11:33:23
Message-Id: w6glfs6keto.fsf@kph.uni-mainz.de
In Reply to: [gentoo-dev] [PATCH] estack.eclass: Properly restore shopt options. by "Ulrich Müller"
1 It isn't (and never was) used by anything else in the tree. Inline its
2 only usage in evar_pop() and drop the function.
3 ---
4 eclass/estack.eclass | 15 ++-------------
5 1 file changed, 2 insertions(+), 13 deletions(-)
6
7 diff --git a/eclass/estack.eclass b/eclass/estack.eclass
8 index b0177bdb358e..2aa6f366dc12 100644
9 --- a/eclass/estack.eclass
10 +++ b/eclass/estack.eclass
11 @@ -115,7 +115,8 @@ evar_pop() {
12 local cnt=${1:-bad}
13 case $# in
14 0) cnt=1 ;;
15 - 1) isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*" ;;
16 + 1) [[ -z ${cnt//[0-9]} ]] \
17 + || die "${FUNCNAME}: first arg must be a number: $*" ;;
18 *) die "${FUNCNAME}: only accepts one arg: $*" ;;
19 esac
20
21 @@ -197,17 +198,5 @@ eumask_pop() {
22 umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
23 }
24
25 -# @FUNCTION: isdigit
26 -# @USAGE: <number> [more numbers]
27 -# @DESCRIPTION:
28 -# Return true if all arguments are numbers.
29 -isdigit() {
30 - local d
31 - for d ; do
32 - [[ ${d:-bad} == *[!0-9]* ]] && return 1
33 - done
34 - return 0
35 -}
36 -
37 _ESTACK_ECLASS=1
38 fi #_ESTACK_ECLASS
39 --
40 2.24.0

Attachments

File name MIME type
signature.asc application/pgp-signature