public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Mike Frysinger (vapier)" <vapier@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] gentoo-x86 commit in eclass: kernel-2.eclass
Date: Fri,  2 Dec 2011 04:19:45 +0000 (UTC)	[thread overview]
Message-ID: <20111202041945.5FE922004B@flycatcher.gentoo.org> (raw)

vapier      11/12/02 04:19:45

  Modified:             kernel-2.eclass
  Log:
  simplify kernel_is logic

Revision  Changes    Path
1.269                eclass/kernel-2.eclass

file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/kernel-2.eclass?rev=1.269&view=markup
plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/kernel-2.eclass?rev=1.269&content-type=text/plain
diff : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/eclass/kernel-2.eclass?r1=1.268&r2=1.269

Index: kernel-2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v
retrieving revision 1.268
retrieving revision 1.269
diff -u -r1.268 -r1.269
--- kernel-2.eclass	2 Dec 2011 02:37:50 -0000	1.268
+++ kernel-2.eclass	2 Dec 2011 04:19:45 -0000	1.269
@@ -1,6 +1,6 @@
 # Copyright 1999-2011 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.268 2011/12/02 02:37:50 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/kernel-2.eclass,v 1.269 2011/12/02 04:19:45 vapier Exp $
 
 # Description: kernel.eclass rewrite for a clean base regarding the 2.6
 #              series of kernel with back-compatibility for 2.4
@@ -394,9 +394,9 @@
 	unset v n
 
 	# Now we can continue
-	local operator test value x=0 y=0 z=0
+	local operator test value
 
-	case ${1} in
+	case $1 in
 	  lt) operator="-lt"; shift;;
 	  gt) operator="-gt"; shift;;
 	  le) operator="-le"; shift;;
@@ -404,24 +404,11 @@
 	  eq) operator="-eq"; shift;;
 	   *) operator="-eq";;
 	esac
+	[[ $# -gt 3 ]] && die "Error in kernel-2_kernel_is(): too many parameters"
 
-	for x in ${@}; do
-		for((y=0; y<$((3 - ${#x})); y++)); do value="${value}0"; done
-		value="${value}${x}"
-		z=$((${z} + 1))
-
-		case ${z} in
-		  1) for((y=0; y<$((3 - ${#KV_MAJOR})); y++)); do test="${test}0"; done;
-			 test="${test}${KV_MAJOR}";;
-		  2) for((y=0; y<$((3 - ${#KV_MINOR})); y++)); do test="${test}0"; done;
-			 test="${test}${KV_MINOR}";;
-		  3) for((y=0; y<$((3 - ${#KV_PATCH})); y++)); do test="${test}0"; done;
-			 test="${test}${KV_PATCH}";;
-		  *) die "Error in kernel-2_kernel_is(): Too many parameters.";;
-		esac
-	done
-
-	[ ${test} ${operator} ${value} ] && return 0 || return 1
+	: $(( value = (KV_MAJOR << 16) + (KV_MINOR << 8) + KV_PATCH ))
+	: $(( test = (${1:-${KV_MAJOR}} << 16) + (${2:-${KV_MINOR}} << 8) + ${3:-${KV_PATCH}} ))
+	[ ${test} ${operator} ${value} ]
 }
 
 kernel_is_2_4() {






             reply	other threads:[~2011-12-02  4:20 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-02  4:19 Mike Frysinger (vapier) [this message]
  -- strict thread matches above, loose matches on Subject: below --
2015-02-13  1:30 [gentoo-commits] gentoo-x86 commit in eclass: kernel-2.eclass Mike Pagano (mpagano)
2013-11-22 13:35 Mike Frysinger (vapier)
2013-07-31 21:25 Julian Ospald (hasufell)
2011-12-10  7:57 Mike Frysinger (vapier)
2011-12-08 19:39 Mike Frysinger (vapier)
2011-12-02  4:34 Mike Frysinger (vapier)
2011-12-02  2:37 Mike Frysinger (vapier)
2011-12-02  2:28 Mike Frysinger (vapier)
2011-12-02  1:54 Mike Frysinger (vapier)
2011-12-02  0:15 Mike Frysinger (vapier)
2011-12-01 23:34 Mike Frysinger (vapier)
2011-12-01 23:32 Mike Frysinger (vapier)
2011-10-24 23:58 Mike Pagano (mpagano)
2011-08-19 13:26 Mike Pagano (mpagano)
2011-08-15 21:38 Mike Pagano (mpagano)
2011-08-11 14:09 Mike Pagano (mpagano)
2011-08-08 23:14 Mike Pagano (mpagano)
2011-08-08 14:14 Mike Pagano (mpagano)
2011-06-03 20:20 Mike Pagano (mpagano)
2011-06-03 13:07 Mike Pagano (mpagano)
2011-04-30 17:07 Ulrich Mueller (ulm)
2011-04-21 12:34 Mike Pagano (mpagano)
2011-04-14  6:10 Ulrich Mueller (ulm)
2011-03-22  0:39 Mike Pagano (mpagano)
2011-03-19 18:15 Samuli Suominen (ssuominen)
2011-03-15 13:16 Mike Pagano (mpagano)
2011-03-10  1:04 Mike Frysinger (vapier)
2011-02-18 20:07 Mike Pagano (mpagano)
2010-11-28  5:07 Robin H. Johnson (robbat2)
2010-11-26 23:41 Mike Pagano (mpagano)
2010-09-17 21:44 Tomas Chvatal (scarabeus)
2010-08-03 18:31 Robin H. Johnson (robbat2)
2010-08-03 17:22 Robin H. Johnson (robbat2)
2010-07-30  0:44 Mike Pagano (mpagano)
2010-07-19 20:19 Mike Frysinger (vapier)
2010-06-05 18:49 Mike Frysinger (vapier)
2010-05-28 21:00 Robin H. Johnson (robbat2)
2010-05-20 23:11 Robin H. Johnson (robbat2)
2010-05-02 11:05 Ulrich Mueller (ulm)
2010-05-02  8:48 Robin H. Johnson (robbat2)
2010-04-26  8:05 Robin H. Johnson (robbat2)
2010-04-26  7:26 Robin H. Johnson (robbat2)
2010-04-26  7:15 Robin H. Johnson (robbat2)
2010-04-26  6:48 Robin H. Johnson (robbat2)
2010-04-26  6:46 Robin H. Johnson (robbat2)
2010-04-26  6:44 Robin H. Johnson (robbat2)
2010-04-01 21:12 Robin H. Johnson (robbat2)
2009-12-13 18:56 Mike Pagano (mpagano)
2009-11-25 18:46 Mike Pagano (mpagano)
2009-10-20 19:51 Robin H. Johnson (robbat2)
2009-10-20 19:17 Zac Medico (zmedico)
2009-10-11 11:43 Markus Meier (maekke)
2009-08-28 16:28 Mike Pagano (mpagano)
2008-11-13 23:50 Mike Pagano (mpagano)
2008-08-07  2:05 Mike Pagano (mpagano)
2008-07-09 19:52 Friedrich Oslage (bluebird)
2008-06-01 23:29 Mike Pagano (mpagano)
2008-05-03 16:07 Daniel Drake (dsd)
2008-04-28 19:22 Mike Pagano (mpagano)
2008-04-12 22:45 Mike Frysinger (vapier)
2008-04-05 12:29 Mike Pagano (mpagano)
2008-03-01 18:47 Bo Oersted Andresen (zlin)
2007-12-17 16:05 Daniel Drake (dsd)

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=20111202041945.5FE922004B@flycatcher.gentoo.org \
    --to=vapier@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