[gnome-builder] build: fix various warnings in release builds



commit 5827f9ae2e7eb4e1b25884e17dd91761abbb6b05
Author: Christian Hergert <chergert redhat com>
Date:   Mon Apr 9 22:38:38 2018 -0700

    build: fix various warnings in release builds

 src/plugins/terminal/gb-terminal-view-actions.c |  3 +--
 src/plugins/xml-pack/ide-xml-parser.c           | 12 ++++++------
 src/tests/test-ide-buffer-manager.c             |  8 ++++----
 src/tests/test-line-reader.c                    |  6 +++---
 4 files changed, 14 insertions(+), 15 deletions(-)
---
diff --git a/src/plugins/terminal/gb-terminal-view-actions.c b/src/plugins/terminal/gb-terminal-view-actions.c
index e4545f6ec..4f9316401 100644
--- a/src/plugins/terminal/gb-terminal-view-actions.c
+++ b/src/plugins/terminal/gb-terminal-view-actions.c
@@ -70,14 +70,13 @@ save_worker (IdeTask      *task,
              gpointer      task_data,
              GCancellable *cancellable)
 {
-  GbTerminalView *view = source_object;
   SaveTask *savetask = (SaveTask *)task_data;
   g_autoptr(GError) error = NULL;
   gboolean ret;
 
   g_assert (IDE_IS_MAIN_THREAD ());
   g_assert (IDE_IS_TASK (task));
-  g_assert (GB_IS_TERMINAL_VIEW (view));
+  g_assert (GB_IS_TERMINAL_VIEW (source_object));
   g_assert (savetask != NULL);
   g_assert (!cancellable || G_IS_CANCELLABLE (cancellable));
 
diff --git a/src/plugins/xml-pack/ide-xml-parser.c b/src/plugins/xml-pack/ide-xml-parser.c
index 94280a546..7dd641fba 100644
--- a/src/plugins/xml-pack/ide-xml-parser.c
+++ b/src/plugins/xml-pack/ide-xml-parser.c
@@ -340,7 +340,6 @@ ide_xml_parser_error_sax_cb (ParserState    *state,
                              const xmlChar  *name,
                              ...)
 {
-  IdeXmlParser *self = (IdeXmlParser *)state->self;
   IdeDiagnostic *diagnostic;
   xmlParserCtxt *context;
   xmlError *error;
@@ -349,7 +348,8 @@ ide_xml_parser_error_sax_cb (ParserState    *state,
   g_autofree gchar *msg = NULL;
   va_list var_args;
 
-  g_assert (IDE_IS_XML_PARSER (self));
+  g_assert (state != NULL);
+  g_assert (IDE_IS_XML_PARSER (state->self));
 
   va_start (var_args, name);
   msg = g_strdup_vprintf ((const gchar *)name, var_args);
@@ -426,10 +426,10 @@ ide_xml_parser_internal_subset_sax_cb (ParserState   *state,
                                        const xmlChar *external_id,
                                        const xmlChar *system_id)
 {
-  IdeXmlParser *self = (IdeXmlParser *)state->self;
   IdeXmlSchemaCacheEntry *entry;
 
-  g_assert (IDE_IS_XML_PARSER (self));
+  g_assert (state != NULL);
+  g_assert (IDE_IS_XML_PARSER (state->self));
 
   entry = ide_xml_schema_cache_entry_new ();
   entry->kind = SCHEMA_KIND_DTD;
@@ -472,14 +472,14 @@ ide_xml_parser_processing_instruction_sax_cb (ParserState   *state,
                                               const xmlChar *target,
                                               const xmlChar *data)
 {
-  IdeXmlParser *self = (IdeXmlParser *)state->self;
   IdeDiagnostic *diagnostic;
   g_autofree gchar *schema_url = NULL;
   const gchar *extension;
   IdeXmlSchemaCacheEntry *entry;
   IdeXmlSchemaKind kind;
 
-  g_assert (IDE_IS_XML_PARSER (self));
+  g_assert (state != NULL);
+  g_assert (IDE_IS_XML_PARSER (state->self));
 
   if (NULL != (schema_url = get_schema_url ((const gchar *)data)))
     {
diff --git a/src/tests/test-ide-buffer-manager.c b/src/tests/test-ide-buffer-manager.c
index 9e6e19896..b247ae4c1 100644
--- a/src/tests/test-ide-buffer-manager.c
+++ b/src/tests/test-ide-buffer-manager.c
@@ -16,6 +16,10 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#ifdef G_DISABLE_ASSERT
+# undef G_DISABLE_ASSERT
+#endif
+
 #include <glib.h>
 #include <glib/gstdio.h>
 #include <ide.h>
@@ -23,10 +27,6 @@
 #include "application/ide-application-tests.h"
 #include "../plugins/gnome-builder-plugins.h"
 
-#ifdef G_DISABLE_ASSERT
-# undef G_DISABLE_ASSERT
-#endif
-
 static gint   save_count;
 static gint   load_count;
 static gchar *tmpfilename;
diff --git a/src/tests/test-line-reader.c b/src/tests/test-line-reader.c
index 032a4b783..b29446d7d 100644
--- a/src/tests/test-line-reader.c
+++ b/src/tests/test-line-reader.c
@@ -16,13 +16,13 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-#include <ide.h>
-#include <string.h>
-
 #ifdef G_DISABLE_ASSERT
 # undef G_DISABLE_ASSERT
 #endif
 
+#include <ide.h>
+#include <string.h>
+
 static void
 test_line_reader_basic (void)
 {


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