From a477a1593bbb534c9815d215909b75c86a6f91b1 Mon Sep 17 00:00:00 2001
From: Cyrille Bagard <nocbos@gmail.com>
Date: Tue, 10 Oct 2023 09:03:59 +0200
Subject: Clean output.

---
 plugins/kaitai/import.c            | 16 +++++-----------
 plugins/kaitai/parsers/attribute.c | 16 +---------------
 plugins/kaitai/parsers/struct.c    |  2 --
 3 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/plugins/kaitai/import.c b/plugins/kaitai/import.c
index 516a091..0412ff7 100644
--- a/plugins/kaitai/import.c
+++ b/plugins/kaitai/import.c
@@ -130,13 +130,10 @@ static GKaitaiType *import_kaitai_definition_from_env(const char *target)
 
         result = g_kaitai_type_new_as_import(target, filename);
 
-        free(filename);
-
         if (result != NULL)
-        {
-            log_variadic_message(LMT_PROCESS, _("Found a required Kaitai definition: %s"), filename);
-            break;
-        }
+            log_variadic_message(LMT_PROCESS, _("Found a required Kaitai definition to import: %s"), filename);
+
+        free(filename);
 
     }
 
@@ -259,13 +256,10 @@ static GKaitaiStruct *load_kaitai_definition_from_env(const char *target)
 
         result = g_kaitai_structure_new_from_file(filename);
 
-        free(filename);
-
         if (result != NULL)
-        {
             log_variadic_message(LMT_PROCESS, _("Found a required Kaitai definition: %s"), filename);
-            break;
-        }
+
+        free(filename);
 
     }
 
diff --git a/plugins/kaitai/parsers/attribute.c b/plugins/kaitai/parsers/attribute.c
index d0505d8..6050bb1 100644
--- a/plugins/kaitai/parsers/attribute.c
+++ b/plugins/kaitai/parsers/attribute.c
@@ -1583,10 +1583,6 @@ static bool _g_kaitai_attribute_parse_content(GKaitaiAttribute *attrib, kaitai_s
     result = false;
     *record = NULL;
 
-    printf("\n");
-    printf("------------parsing %s -( payload: %x - ut=%d )-----------\n",
-           attrib->raw_id, attrib->payload, attrib->payload & KAP_USER_TYPE);
-
     /* Lecture soumise à condition ? */
 
     if (attrib->condition != NULL)
@@ -1596,8 +1592,6 @@ static bool _g_kaitai_attribute_parse_content(GKaitaiAttribute *attrib, kaitai_s
                                                       strlen(attrib->condition),
                                                       &authorized);
 
-        printf("condition '%s': res=%d  auth=%d\n", attrib->condition, result, authorized.status);
-
         if (!result || !authorized.status)
             goto exit;
 
@@ -1664,10 +1658,7 @@ static bool _g_kaitai_attribute_parse_content(GKaitaiAttribute *attrib, kaitai_s
     /* Etablissement d'une zone de correspondance */
 
     if (attrib->payload == KAP_UNINITIALIZED)
-    {
-        printf("attrib: '%s'\n", attrib->raw_id);
-        //assert(false);
-    }
+        assert(false);
 
     else if (attrib->payload & KAP_SIZED_EOS)
     {
@@ -1763,9 +1754,6 @@ static bool _g_kaitai_attribute_parse_content(GKaitaiAttribute *attrib, kaitai_s
     {
         user_type = find_sub_type(locals, attrib->named_type);
 
-        printf(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> find '%s' => %p\n",
-               attrib->named_type, user_type);
-
         if (user_type != NULL)
         {
             result = g_kaitai_parser_parse_content(G_KAITAI_PARSER(user_type),
@@ -1867,8 +1855,6 @@ static bool _g_kaitai_attribute_parse_content(GKaitaiAttribute *attrib, kaitai_s
 
  exit:
 
-    printf(" ===[[ %s / %p ]]===  >>  %d\n", attrib->raw_id, attrib, result);
-
     return result;
 
 }
diff --git a/plugins/kaitai/parsers/struct.c b/plugins/kaitai/parsers/struct.c
index 62dc25a..d447cf3 100644
--- a/plugins/kaitai/parsers/struct.c
+++ b/plugins/kaitai/parsers/struct.c
@@ -722,8 +722,6 @@ GMatchRecord *g_kaitai_structure_parse(GKaitaiStruct *kstruct, GBinContent *cont
 
     g_kaitai_parser_parse_content(G_KAITAI_PARSER(kstruct), &locals, content, &epos, &result);
 
-    printf("FINAL STATUS :: %d\n", result != NULL);
-
     return result;
 
 }
-- 
cgit v0.11.2-87-g4458