[gnome-builder/wip/slaf/xml-pack: 54/56] xml-pack: remove debug statements



commit 95eb917454686312b5e0ed807a49628af0555d35
Author: Sebastien Lafargue <slafargue gnome org>
Date:   Thu Jul 13 12:24:55 2017 +0200

    xml-pack: remove debug statements

 plugins/xml-pack/ide-xml-completion-attributes.c |   11 +--------
 plugins/xml-pack/ide-xml-completion-provider.c   |   10 +--------
 plugins/xml-pack/ide-xml-parser.c                |    7 ------
 plugins/xml-pack/ide-xml-rng-parser.c            |    7 ------
 plugins/xml-pack/ide-xml-service.c               |    4 +--
 plugins/xml-pack/ide-xml-symbol-node.c           |    2 -
 plugins/xml-pack/ide-xml-tree-builder.c          |   25 +++++++++++++--------
 7 files changed, 19 insertions(+), 47 deletions(-)
---
diff --git a/plugins/xml-pack/ide-xml-completion-attributes.c 
b/plugins/xml-pack/ide-xml-completion-attributes.c
index 5163af3..d322ad0 100644
--- a/plugins/xml-pack/ide-xml-completion-attributes.c
+++ b/plugins/xml-pack/ide-xml-completion-attributes.c
@@ -300,8 +300,6 @@ process_matching_state (MatchingState   *state,
   else
     type = define->type;
 
-  printf ("ATTR process_matching_state: def:%s\n", ide_xml_rng_define_get_type_name (define));
-
   switch (type)
     {
     case IDE_XML_RNG_DEFINE_ATTRIBUTE:
@@ -379,10 +377,7 @@ create_initial_matching_state (IdeXmlRngDefine  *define,
       if (NULL != (attributes = ide_xml_symbol_node_get_attributes_names (node)))
         {
           for (gint i = 0; attributes [i] != NULL; i++)
-            {
-              printf ("orig ATTR:'%s'\n", attributes [i]);
-              g_ptr_array_add (state->node_attr, (gchar *)attributes [i]);
-            }
+            g_ptr_array_add (state->node_attr, (gchar *)attributes [i]);
         }
     }
 
@@ -469,9 +464,7 @@ set_position (MatchingState *state)
       index = -1;
     }
   else
-    {
-      propagate_mandatory (state);
-    }
+    propagate_mandatory (state);
 
   state->define->pos = index;
 }
diff --git a/plugins/xml-pack/ide-xml-completion-provider.c b/plugins/xml-pack/ide-xml-completion-provider.c
index dc6f189..270988d 100644
--- a/plugins/xml-pack/ide-xml-completion-provider.c
+++ b/plugins/xml-pack/ide-xml-completion-provider.c
@@ -890,7 +890,6 @@ populate_cb (GObject      *object,
 
   if (NULL != (candidates = get_matching_candidates (self, schemas, path)))
     {
-
       if (complete_attributes)
         {
           for (gint i = 0; i < candidates->len; ++i)
@@ -919,8 +918,6 @@ populate_cb (GObject      *object,
           for (gint i = 0; i < candidates->len; ++i)
             {
               def = g_ptr_array_index (candidates, i);
-              ide_xml_rng_define_dump_tree (def, FALSE);
-              printf ("----------\n");
 
               initial_state = create_initial_matching_state (position, def, items);
               process_matching_state (initial_state, def);
@@ -970,11 +967,6 @@ ide_xml_completion_provider_populate (GtkSourceCompletionProvider *self,
   state->line = gtk_text_iter_get_line (&iter) + 1;
   state->line_offset = gtk_text_iter_get_line_offset (&iter) + 1;
 
-  printf ("path:%s at (%i,%i)\n",
-          g_file_get_path (ide_file_get_file (state->ifile)),
-          state->line,
-          state->line_offset);
-
   ide_xml_service_get_position_from_cursor_async (service,
                                                   state->ifile,
                                                   buffer,
@@ -1053,7 +1045,7 @@ ide_xml_completion_provider_class_init (IdeXmlCompletionProviderClass *klass)
 static void
 ide_xml_completion_provider_init (IdeXmlCompletionProvider *self)
 {
-  printf ("xml completion provider init\n");
+  ;
 }
 
 static void
diff --git a/plugins/xml-pack/ide-xml-parser.c b/plugins/xml-pack/ide-xml-parser.c
index c0310f5..9be76a1 100644
--- a/plugins/xml-pack/ide-xml-parser.c
+++ b/plugins/xml-pack/ide-xml-parser.c
@@ -119,7 +119,6 @@ ide_xml_parser_create_diagnostic (ParserState            *state,
   g_assert (IDE_IS_XML_PARSER (self));
 
   context = ide_object_get_context (IDE_OBJECT (self));
-
   ide_xml_sax_get_location (self->sax_parser,
                             &start_line, &start_line_offset,
                             &end_line, &end_line_offset,
@@ -450,8 +449,6 @@ ide_xml_parser_internal_subset_sax_cb (ParserState   *state,
 
   g_assert (IDE_IS_XML_PARSER (self));
 
-  printf ("internal subset:%s external_id:%s system_id:%s\n", name, external_id, system_id);
-
   entry = ide_xml_schema_cache_entry_new ();
   entry->kind = SCHEMA_KIND_DTD;
   ide_xml_sax_get_location (self->sax_parser, &entry->line, &entry->col, NULL, NULL, NULL, NULL);
@@ -467,8 +464,6 @@ ide_xml_parser_external_subset_sax_cb (ParserState   *state,
   IdeXmlParser *self = (IdeXmlParser *)state->self;
 
   g_assert (IDE_IS_XML_PARSER (self));
-
-  printf ("external subset:%s external_id:%s system_id:%s\n", name, external_id, system_id);
 }
 
 static GFile *
@@ -484,12 +479,10 @@ get_absolute_schema_file (GFile       *file,
   if (scheme == NULL)
     {
       parent = g_file_get_parent (file);
-      printf ("parent:%s\n", g_file_get_uri (parent));
       if (NULL == (abs_file = g_file_resolve_relative_path (parent, schema_url)))
         abs_file = g_file_new_for_path (schema_url);
     }
 
-  printf ("url:%s file url:%s\n", schema_url, (abs_file) ? g_file_get_uri (abs_file) : NULL);
   return abs_file;
 }
 
diff --git a/plugins/xml-pack/ide-xml-rng-parser.c b/plugins/xml-pack/ide-xml-rng-parser.c
index e1f4ffd..56edc6a 100644
--- a/plugins/xml-pack/ide-xml-rng-parser.c
+++ b/plugins/xml-pack/ide-xml-rng-parser.c
@@ -1583,7 +1583,6 @@ merge_refs_func (const gchar *name,
     return;
 
   /* TODO: grammar->defines need to be linked by hash  ? */
-  printf ("ref lookup:%s\n", name);
   if (NULL != (def_array = ide_xml_hash_table_lookup (grammar->defines, name)))
     {
       def = g_ptr_array_index (def_array, 0);
@@ -1995,12 +1994,6 @@ ide_xml_rng_parser_parse (IdeXmlRngParser *self,
     /* TODO: transfer other self fields to schema */
 
     /* TODO: code at L7546 */
-
-    xmlDocDumpMemory (doc, &mem, &size);
-    xmlFree (mem);
-
-    if (self->grammars != NULL)
-      ide_xml_rng_grammar_dump_tree (self->grammars);
   }
 
 end:
diff --git a/plugins/xml-pack/ide-xml-service.c b/plugins/xml-pack/ide-xml-service.c
index eadc3f1..1d8da3b 100644
--- a/plugins/xml-pack/ide-xml-service.c
+++ b/plugins/xml-pack/ide-xml-service.c
@@ -827,7 +827,7 @@ loop:
           child_node = IDE_XML_SYMBOL_NODE (ide_xml_symbol_node_get_nth_direct_child (current_node, n));
           child_pos = n;
           rel_pos = ide_xml_symbol_node_compare_location (child_node, line, line_offset);
-          printf ("node:%s rel pos:%d\n", ide_xml_symbol_node_get_element_name (child_node), rel_pos);
+
           switch (rel_pos)
             {
             case IDE_XML_SYMBOL_NODE_RELATIVE_POSITION_IN_START_TAG:
@@ -930,9 +930,7 @@ result:
     g_assert_not_reached ();
 
   if (child_pos > 0)
-    {
     previous_sibling_node = IDE_XML_SYMBOL_NODE (ide_xml_symbol_node_get_nth_direct_child (candidate_node, 
child_pos - 1));
-    }
 
   if (child_pos < n_children)
     next_sibling_node = IDE_XML_SYMBOL_NODE (ide_xml_symbol_node_get_nth_direct_child (candidate_node, 
child_pos));
diff --git a/plugins/xml-pack/ide-xml-symbol-node.c b/plugins/xml-pack/ide-xml-symbol-node.c
index 85a4934..cb1f5af 100644
--- a/plugins/xml-pack/ide-xml-symbol-node.c
+++ b/plugins/xml-pack/ide-xml-symbol-node.c
@@ -644,8 +644,6 @@ ide_xml_symbol_node_compare_location (IdeXmlSymbolNode *ref_node,
 {
   gint pos;
 
-  print_node_ranges (ref_node);
-
   pos = is_in_range(ref_node->start_tag, line, line_offset);
   if (pos == -1)
     return IDE_XML_SYMBOL_NODE_RELATIVE_POSITION_BEFORE;
diff --git a/plugins/xml-pack/ide-xml-tree-builder.c b/plugins/xml-pack/ide-xml-tree-builder.c
index 6136abf..99ea34d 100644
--- a/plugins/xml-pack/ide-xml-tree-builder.c
+++ b/plugins/xml-pack/ide-xml-tree-builder.c
@@ -231,8 +231,6 @@ fetch_schemas_async (IdeXmlTreeBuilder   *self,
                                 cancellable,
                                 fetch_schemas_cb,
                                 state);
-
-      printf ("fetching schema URL:%s\n", g_file_get_uri (entry->file));
     }
 
   if (!has_external_schemas)
@@ -299,6 +297,8 @@ ide_xml_tree_builder_build_tree_cb2 (GObject      *object,
           gsize schema_size;
           g_autoptr (IdeDiagnostics) diagnostics = NULL;
           g_autoptr (IdeDiagnostic) diagnostic = NULL;
+          g_autofree gchar *uri = NULL;
+          g_autofree gchar *msg = NULL;
           gboolean schema_ret;
 
           entry = g_ptr_array_index (schemas, i);
@@ -337,9 +337,6 @@ ide_xml_tree_builder_build_tree_cb2 (GObject      *object,
 
           if (!schema_ret)
             {
-              g_autofree gchar *uri = NULL;
-              g_autofree gchar *msg = NULL;
-
               uri = g_file_get_uri (entry->file);
               msg = g_strdup_printf ("Can't parse the schema: '%s'", uri);
               diagnostic = create_diagnostic (context,
@@ -352,10 +349,18 @@ ide_xml_tree_builder_build_tree_cb2 (GObject      *object,
               continue;
             }
 
-          if (ide_xml_validator_validate (self->validator, doc, &diagnostics))
-            printf ("validated\n");
-          else
-            printf ("NOT validated\n");
+          if (!ide_xml_validator_validate (self->validator, doc, &diagnostics))
+            {
+              uri = g_file_get_uri (entry->file);
+              msg = g_strdup_printf ("Can't validate the schema: '%s'", uri);
+              diagnostic = create_diagnostic (context,
+                                              msg,
+                                              state->file,
+                                              entry->line,
+                                              entry->col,
+                                              IDE_DIAGNOSTIC_ERROR);
+              ide_diagnostics_add (state->analysis->diagnostics, diagnostic);
+            }
 
           ide_diagnostics_merge (state->analysis->diagnostics, diagnostics);
         }
@@ -365,7 +370,7 @@ ide_xml_tree_builder_build_tree_cb2 (GObject      *object,
   else
     {
       /* TODO: set error */
-      printf ("can't create xmlDoc\n");
+      g_debug ("can't create xmlDoc\n");
     }
 
   g_task_return_pointer (task, state->analysis, (GDestroyNotify)ide_xml_analysis_unref);


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