commit:     90a6419e5f0982baa1493749f6fb1b3c2fe33e7d
Author:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 20 17:19:35 2021 +0000
Commit:     Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 21 18:19:45 2021 +0000
URL:        https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=90a6419e

initrd.scripts: is_true(): Optimize for most frequently used value

Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>

 defaults/initrd.scripts | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/defaults/initrd.scripts b/defaults/initrd.scripts
index 8dcb9e2..ccbc16d 100644
--- a/defaults/initrd.scripts
+++ b/defaults/initrd.scripts
@@ -628,7 +628,10 @@ is_log_enabled() {
 }
 
 is_true() {
-       case "$1" in
+       case "${1}" in
+               1)
+                       return 0
+               ;;
                [Tt][Rr][Uu][Ee])
                        return 0
                ;;
@@ -641,10 +644,8 @@ is_true() {
                [Yy])
                        return 0
                ;;
-               1)
-                       return 0
-               ;;
        esac
+
        return 1
 }
 

Reply via email to