estack.eclass: Drop isdigit function.
authorUlrich Müller <ulm@gentoo.org>
Sat, 23 Nov 2019 11:28:22 +0000 (12:28 +0100)
committerUlrich Müller <ulm@gentoo.org>
Tue, 26 Nov 2019 19:23:20 +0000 (20:23 +0100)
It isn't (and never was) used by anything else in the tree. Inline its
only usage in evar_pop() and drop the function.

Signed-off-by: Ulrich Müller <ulm@gentoo.org>
eclass/estack.eclass

index b0177bdb358ebd37d704d1d9308811dab4e72e39..2aa6f366dc12200a97ac9c3527480f729a6fb59c 100644 (file)
@@ -115,7 +115,8 @@ evar_pop() {
        local cnt=${1:-bad}
        case $# in
        0) cnt=1 ;;
-       1) isdigit "${cnt}" || die "${FUNCNAME}: first arg must be a number: $*" ;;
+       1) [[ -z ${cnt//[0-9]} ]] \
+               || die "${FUNCNAME}: first arg must be a number: $*" ;;
        *) die "${FUNCNAME}: only accepts one arg: $*" ;;
        esac
 
@@ -197,17 +198,5 @@ eumask_pop() {
        umask ${s} || die "${FUNCNAME}: sanity: could not restore umask: ${s}"
 }
 
-# @FUNCTION: isdigit
-# @USAGE: <number> [more numbers]
-# @DESCRIPTION:
-# Return true if all arguments are numbers.
-isdigit() {
-       local d
-       for d ; do
-               [[ ${d:-bad} == *[!0-9]* ]] && return 1
-       done
-       return 0
-}
-
 _ESTACK_ECLASS=1
 fi #_ESTACK_ECLASS