From ee0c303615c3c4cfac4f778f6bfbb5bd2cc62859 Mon Sep 17 00:00:00 2001 From: Patrick McDermott Date: Thu, 14 Mar 2019 23:47:09 -0400 Subject: _ob_match_arch(): Remove loop ob_arch_is_concerned() calls this function with just one field arch at a time, so this only needs to handle one arch. --- diff --git a/lib/metadata.sh b/lib/metadata.sh index 9249f87..80ec274 100644 --- a/lib/metadata.sh +++ b/lib/metadata.sh @@ -161,43 +161,35 @@ ob_get_system_plat() _ob_match_arch() { local match_arch="${1}" - local arch_field="${2}" + local field_arch="${2}" shift 2 || _ob_abort - local field_arch= local match_arch_rest= local field_arch_rest= local match_arch_part= local field_arch_part= - for field_arch in ${arch_field}; do - - # "foo-bar-baz" == "any" - if [ x"${field_arch}" = x'any' ]; then - return 0 - fi - - # "foo-bar-baz" == "foo-any-any" - match_arch_rest="${match_arch}" - field_arch_rest="${field_arch}" - while [ -n "${match_arch_rest}" ] && [ -n "${field_arch_rest}" ] - do - IFS='-' read match_arch_part match_arch_rest <<-EOF - ${match_arch_rest} - EOF - IFS='-' read field_arch_part field_arch_rest <<-EOF - ${field_arch_rest} - EOF - case "${field_arch_part}" in - "${match_arch_part}" | 'any') ;; - *) continue 2;; # Failed match, go to next arch - esac - done + # "foo-bar-baz" == "any" + if [ x"${field_arch}" = x'any' ]; then return 0 + fi + # "foo-bar-baz" == "foo-any-any" + match_arch_rest="${match_arch}" + field_arch_rest="${field_arch}" + while [ -n "${match_arch_rest}" ] && [ -n "${field_arch_rest}" ]; do + IFS='-' read match_arch_part match_arch_rest <<-EOF + ${match_arch_rest} + EOF + IFS='-' read field_arch_part field_arch_rest <<-EOF + ${field_arch_rest} + EOF + case "${field_arch_part}" in + "${match_arch_part}" | 'any') ;; + *) return 1;; # Failed match + esac done - # Nothing matched. - return 1 + return 0 } _ob_match_plat() -- cgit v0.9.1