From 39333fdb339aff571b2fd4af635de5a6096059df Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Sat, 14 Nov 2020 13:47:48 +0100 Subject: [PATCH] dir: Minor optimization to find_used_ref() Its commonly the case that a runtime lists itself as its runtime and/or sdk. So, short circuit this in the finding of used refs. --- common/flatpak-dir.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index bd4b28d9..bb2395ee 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -15755,7 +15755,7 @@ find_used_refs (FlatpakDir *self, if (runtime) { g_autoptr(FlatpakDecomposed) runtime_ref = flatpak_decomposed_new_from_pref (FLATPAK_KINDS_RUNTIME, runtime, NULL); - if (runtime_ref) + if (runtime_ref && !flatpak_decomposed_equal (runtime_ref, ref_to_analyze)) queue_ref_for_analysis (runtime_ref, arch, analyzed_refs, refs_to_analyze); } } @@ -15765,7 +15765,7 @@ find_used_refs (FlatpakDir *self, if (sdk) { g_autoptr(FlatpakDecomposed) sdk_ref = flatpak_decomposed_new_from_pref (FLATPAK_KINDS_RUNTIME, sdk, NULL); - if (sdk_ref) + if (sdk_ref && !flatpak_decomposed_equal (sdk_ref, ref_to_analyze)) queue_ref_for_analysis (sdk_ref, arch, analyzed_refs, refs_to_analyze); }