public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/
Date: Wed,  6 Sep 2017 13:45:28 +0000 (UTC)	[thread overview]
Message-ID: <1504705486.0027cf6d4b6110dbaf5876ee0e891342fae3c984.mgorny@gentoo> (raw)

commit:     0027cf6d4b6110dbaf5876ee0e891342fae3c984
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Wed Sep  6 13:44:17 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Sep  6 13:44:46 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0027cf6d

eapi7-ver.eclass: Use the power of maths to simplify splitting

 eclass/eapi7-ver.eclass | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/eclass/eapi7-ver.eclass b/eclass/eapi7-ver.eclass
index 70a1b3e9847..27571bc0d03 100644
--- a/eclass/eapi7-ver.eclass
+++ b/eclass/eapi7-ver.eclass
@@ -51,7 +51,7 @@ _version_split() {
 }
 
 version_cut() {
-	local start end istart iend
+	local start end istart
 	local -a comp
 
 	_version_parse_range "$1"
@@ -59,14 +59,12 @@ version_cut() {
 
 	local IFS=
 	if [[ ${start} -gt 0 ]]; then
-		istart=$(( (start-1)*2 + 1 ))
-		iend=$(( (end-start)*2 + 1 ))
+		istart=$(( start*2 - 1 ))
 	else
 		istart=0
-		iend=$(( (end-start)*2 ))
 	fi
 	if [[ ${end} ]]; then
-		echo "${comp[*]:istart:iend}"
+		echo "${comp[*]:istart:end*2-istart}"
 	else
 		echo "${comp[*]:istart}"
 	fi


             reply	other threads:[~2017-09-06 13:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-06 13:45 Michał Górny [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-23  5:46 [gentoo-commits] repo/gentoo:eapi7-ver commit in: eclass/ Ulrich Müller
2017-09-22 21:28 Ulrich Müller
2017-09-22 16:10 Ulrich Müller
2017-09-21 14:04 Michał Górny
2017-09-21 14:04 Michał Górny
2017-09-21 13:26 Ulrich Müller
2017-09-21 12:57 Ulrich Müller
2017-09-21  7:38 Ulrich Müller
2017-09-21  7:04 Michał Górny
2017-09-20 21:19 Ulrich Müller
2017-09-12 16:37 Ulrich Müller
2017-09-12 16:37 Ulrich Müller
2017-09-08 11:11 Michał Górny
2017-09-08 11:11 Michał Górny
2017-09-06 15:31 Michał Górny
2017-09-06 15:22 Michał Górny
2017-09-06 13:45 Michał Górny
2017-09-06 13:40 Michał Górny

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1504705486.0027cf6d4b6110dbaf5876ee0e891342fae3c984.mgorny@gentoo \
    --to=mgorny@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox