From d1d580cafa4b598c37444753846f3e21ba341f62 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 15 Apr 2025 18:33:29 +0200 Subject: [PATCH] pod: move common check outside of the loop --- spa/include/spa/pod/filter.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spa/include/spa/pod/filter.h b/spa/include/spa/pod/filter.h index 544e25f7b..d32d9ad15 100644 --- a/spa/include/spa/pod/filter.h +++ b/spa/include/spa/pod/filter.h @@ -209,15 +209,15 @@ spa_pod_filter_prop(struct spa_pod_builder *b, bool found_def = false; /* we should prefer the alt2 range default value but only if valid */ - for (j = 0, a1 = alt1; j < nalt1; j++, a1 = SPA_PTROFF(a1,size,void)) { - if (spa_pod_compare_value(type, alt2, min, size) < 0 || - spa_pod_compare_value(type, alt2, max, size) > 0) - break; - if (spa_pod_compare_value(type, a1, alt2, size) == 0) { - /* it is in the enum, use as default then */ - spa_pod_builder_raw(b, a1, size); - found_def = true; - break; + if (spa_pod_compare_value(type, alt2, min, size) >= 0 && + spa_pod_compare_value(type, alt2, max, size) <= 0) { + for (j = 0, a1 = alt1; j < nalt1; j++, a1 = SPA_PTROFF(a1,size,void)) { + if (spa_pod_compare_value(type, a1, alt2, size) == 0) { + /* it is in the enum, use as default then */ + spa_pod_builder_raw(b, a1, size); + found_def = true; + break; + } } } /* copy all values inside the range */