[gtksourceview] build: fix build with assertions disabled



commit ec0c2fb660c8b4e2f4f789ca400ac4d3a4032404
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jan 29 09:12:26 2020 -0800

    build: fix build with assertions disabled

 gtksourceview/gtksourcelanguage-parser-2.c | 7 ++++++-
 gtksourceview/gtksourceview.c              | 9 ++++++---
 2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/gtksourceview/gtksourcelanguage-parser-2.c b/gtksourceview/gtksourcelanguage-parser-2.c
index 8b61ec04..b43262f6 100644
--- a/gtksourceview/gtksourcelanguage-parser-2.c
+++ b/gtksourceview/gtksourcelanguage-parser-2.c
@@ -1466,7 +1466,7 @@ static void
 handle_keyword_char_class_element (ParserState *parser_state)
 {
        xmlChar *char_class;
-       int ret, type;
+       int type;
 
        g_return_if_fail (parser_state->error == NULL);
 
@@ -1474,6 +1474,11 @@ handle_keyword_char_class_element (ParserState *parser_state)
                return;
 
        do {
+#ifndef G_DISABLE_ASSERT
+               G_GNUC_UNUSED
+#endif
+               int ret;
+
                ret = xmlTextReaderRead (parser_state->reader);
                g_assert (ret == 1);
                type = xmlTextReaderNodeType (parser_state->reader);
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index a146ccfa..e10584aa 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -1512,12 +1512,15 @@ search_start_cb (GtkSourceBufferInternal *buffer_internal,
 {
        GtkTextIter visible_start;
        GtkTextIter visible_end;
-       GtkSourceBuffer *buffer_search;
 
        get_visible_region (GTK_TEXT_VIEW (view), &visible_start, &visible_end);
 
-       buffer_search = gtk_source_search_context_get_buffer (search_context);
-       g_assert (buffer_search == view->priv->source_buffer);
+#ifndef G_DISABLE_ASSERT
+       {
+               GtkSourceBuffer *buffer_search = gtk_source_search_context_get_buffer (search_context);
+               g_assert (buffer_search == view->priv->source_buffer);
+       }
+#endif
 
        _gtk_source_search_context_update_highlight (search_context,
                                                     &visible_start,


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