[gtk+/gtk-3-20] debug: remove open-coded debug checks in gtktextsegment
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-3-20] debug: remove open-coded debug checks in gtktextsegment
- Date: Thu, 5 May 2016 19:19:37 +0000 (UTC)
commit 8653bb81229fb375cafb44cdc9ee3a3d94edbdde
Author: Christian Hergert <christian hergert me>
Date: Tue Apr 19 19:35:52 2016 -0700
debug: remove open-coded debug checks in gtktextsegment
These runtime checks were being performed whether or not we were in a
debug build. Using GTK_DEBUG_CHECK() will compile out of production
builds, as it will result in something like:
if (G_UNLIKELY(0))
which the optimizer can prune.
https://bugzilla.gnome.org/show_bug.cgi?id=765284
gtk/gtktextsegment.c | 14 +++++++-------
1 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtktextsegment.c b/gtk/gtktextsegment.c
index beb92cf..8539db5 100644
--- a/gtk/gtktextsegment.c
+++ b/gtk/gtktextsegment.c
@@ -103,7 +103,7 @@ gtk_text_line_segment_split (const GtkTextIter *iter)
count = gtk_text_iter_get_line_index (iter);
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_iter_check (iter);
prev = NULL;
@@ -203,7 +203,7 @@ _gtk_char_segment_new (const gchar *text, guint len)
seg->char_count = g_utf8_strlen (seg->body.chars, seg->byte_count);
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
char_segment_self_check (seg);
return seg;
@@ -232,7 +232,7 @@ _gtk_char_segment_new_from_two_strings (const gchar *text1,
seg->char_count = chars1 + chars2;
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
char_segment_self_check (seg);
return seg;
@@ -274,7 +274,7 @@ char_segment_split_func (GtkTextLineSegment *seg, int index)
g_assert (index < seg->byte_count);
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
{
char_segment_self_check (seg);
}
@@ -290,7 +290,7 @@ char_segment_split_func (GtkTextLineSegment *seg, int index)
new1->next = new2;
new2->next = seg->next;
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
{
char_segment_self_check (new1);
char_segment_self_check (new2);
@@ -329,7 +329,7 @@ char_segment_cleanup_func (GtkTextLineSegment *segPtr, GtkTextLine *line)
{
GtkTextLineSegment *segPtr2, *newPtr;
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
char_segment_self_check (segPtr);
segPtr2 = segPtr->next;
@@ -348,7 +348,7 @@ char_segment_cleanup_func (GtkTextLineSegment *segPtr, GtkTextLine *line)
newPtr->next = segPtr2->next;
- if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
+ if (GTK_DEBUG_CHECK (TEXT))
char_segment_self_check (newPtr);
_gtk_char_segment_free (segPtr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]