From ca2df1f2723257458fc236c30a8382d330ad25ef Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Sun, 24 May 2020 04:53:23 +0200 Subject: [PATCH] babl: improve debug output for BABL_DEBUG_MISSING Report both missing fishes and fishes that occur at the maximum search depth. --- babl/babl-fish-path.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/babl/babl-fish-path.c b/babl/babl-fish-path.c index bd0d47e..8c431d1 100644 --- a/babl/babl-fish-path.c +++ b/babl/babl-fish-path.c @@ -509,6 +509,15 @@ babl_fish_path2 (const Babl *source, const Babl *sRGB = babl_space ("sRGB"); char name[BABL_MAX_NAME_LEN]; int is_fast = 0; + static int debug_missing = -1; + if (debug_missing < 0) + { + const char *val = getenv ("BABL_DEBUG_MISSING"); + if (val && strcmp (val, "0")) + debug_missing = 1; + else + debug_missing = 0; + } _babl_fish_create_name (name, source, destination, 1); babl_mutex_lock (babl_format_mutex); @@ -612,20 +621,14 @@ babl_fish_path2 (const Babl *source, get_conversion_path (&pc, (Babl *) source, 0, max_depth, tolerance); } - if (!babl->fish_path.conversion_list->count) + if (debug_missing) { - static int show_missing = -1; - if (show_missing < 0) - { - const char *val = getenv ("BABL_DEBUG_MISSING"); - if (val && strcmp (val, "0")) - show_missing = 1; - else - show_missing = 0; - } - if (show_missing) - fprintf (stderr, "babl is lacking conversion for %s to %s\n", - babl_get_name (source), babl_get_name (destination)); + if (babl->fish_path.conversion_list->count == 0) + fprintf (stderr, "babl: lacking conversion path for %s to %s\n", + babl_get_name (source), babl_get_name (destination)); + else if (babl->fish_path.conversion_list->count == end_depth) + fprintf (stderr, "babl: need %i step conversion for %s to %s\n", end_depth, + babl_get_name (source), babl_get_name (destination)); } babl_in_fish_path--; -- 2.30.2