[babl] babl: improve debug output for BABL_DEBUG_MISSING



commit ca2df1f2723257458fc236c30a8382d330ad25ef
Author: Øyvind Kolås <pippin gimp org>
Date:   Sun May 24 04:53:23 2020 +0200

    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 bd0d47eb3..8c431d1db 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--;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]