commit:     22274b50ced4f737d554443dcc37ff8c32083b3c
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sat Jun  7 12:15:09 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun  7 22:54:13 2025 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=22274b50

ecompress: drop the 'suffix' variable from guess_suffix()

With some minor refactoring, the 'suffix' variable that is local to the
guess_suffix() function becomes unnecessary. Drop it.

Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 bin/ecompress | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/bin/ecompress b/bin/ecompress
index 26051d1a47..0cb18c73ac 100755
--- a/bin/ecompress
+++ b/bin/ecompress
@@ -102,7 +102,7 @@ do_queue() {
 }
 
 guess_suffix() {
-       local IFS f i suffix tmpdir
+       local IFS f i tmpdir
        local -a cmd
 
        trap 'rm -rf -- "${tmpdir}"' RETURN
@@ -125,13 +125,10 @@ guess_suffix() {
        # If PORTAGE_COMPRESS_FLAGS contains -k then we need to avoid
        # having our glob match the uncompressed file here.
        for f in compressme?*; do
-               if [[ -e ${f} ]]; then
-                       suffix=${f#compressme}
-                       break
-               fi
+               test -e "${f}" \
+               && printf '%s\n' "${f#compressme}" \
+               && return
        done
-
-       [[ ${suffix} ]] && printf '%s\n' "${suffix}"
 }
 
 fix_symlinks() {

Reply via email to