Commit 3526b08e authored by Matthias Clasen's avatar Matthias Clasen

Clean up debug features

Introduce a GTK_DEBUG_CHECK() macro and use it to check for
GTK_DEBUG flags everywhere. Also guard all such places by
parent 1b155887
...@@ -752,7 +752,7 @@ _gtk_builder_construct (GtkBuilder *builder, ...@@ -752,7 +752,7 @@ _gtk_builder_construct (GtkBuilder *builder,
g_object_set_property (obj, param->name, &param->value); g_object_set_property (obj, param->name, &param->value);
#if G_ENABLE_DEBUG #if G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_BUILDER) if (GTK_DEBUG_CHECK (BUILDER))
{ {
gchar *str = g_strdup_value_contents ((const GValue*)&param->value); gchar *str = g_strdup_value_contents ((const GValue*)&param->value);
g_print ("set %s: %s = %s\n", info->id, param->name, str); g_print ("set %s: %s = %s\n", info->id, param->name, str);
...@@ -816,7 +816,7 @@ _gtk_builder_apply_properties (GtkBuilder *builder, ...@@ -816,7 +816,7 @@ _gtk_builder_apply_properties (GtkBuilder *builder,
g_object_set_property (info->object, param->name, &param->value); g_object_set_property (info->object, param->name, &param->value);
#if G_ENABLE_DEBUG #if G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_BUILDER) if (GTK_DEBUG_CHECK (BUILDER))
{ {
gchar *str = g_strdup_value_contents ((const GValue*)&param->value); gchar *str = g_strdup_value_contents ((const GValue*)&param->value);
g_print ("set %s: %s = %s\n", info->id, param->name, str); g_print ("set %s: %s = %s\n", info->id, param->name, str);
......
...@@ -926,7 +926,7 @@ start_element (GMarkupParseContext *context, ...@@ -926,7 +926,7 @@ start_element (GMarkupParseContext *context,
ParserData *data = (ParserData*)user_data; ParserData *data = (ParserData*)user_data;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_BUILDER) if (GTK_DEBUG_CHECK (BUILDER))
{ {
GString *tags = g_string_new (""); GString *tags = g_string_new ("");
int i; int i;
......
...@@ -1265,8 +1265,10 @@ gtk_css_node_validate_internal (GtkCssNode *cssnode, ...@@ -1265,8 +1265,10 @@ gtk_css_node_validate_internal (GtkCssNode *cssnode,
* Note that this also completely revalidates child widgets all * Note that this also completely revalidates child widgets all
* the time. * the time.
*/ */
if (G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_NO_CSS_CACHE)) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (NO_CSS_CACHE))
cssnode->pending_changes |= GTK_CSS_CHANGE_ANY; cssnode->pending_changes |= GTK_CSS_CHANGE_ANY;
#endif
if (!cssnode->invalid) if (!cssnode->invalid)
return; return;
......
...@@ -59,12 +59,15 @@ typedef enum { ...@@ -59,12 +59,15 @@ typedef enum {
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
#define GTK_NOTE(type,action) G_STMT_START { \ #define GTK_DEBUG_CHECK(type) G_UNLIKELY (gtk_get_debug_flags () & GTK_DEBUG_##type)
if (gtk_get_debug_flags () & GTK_DEBUG_##type) \
#define GTK_NOTE(type,action) G_STMT_START { \
if (GTK_DEBUG_CHECK (type)) \
{ action; }; } G_STMT_END { action; }; } G_STMT_END
#else /* !G_ENABLE_DEBUG */ #else /* !G_ENABLE_DEBUG */
#define GTK_DEBUG_CHECK(type) 0
#define GTK_NOTE(type, action) #define GTK_NOTE(type, action)
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
......
...@@ -122,8 +122,7 @@ _gtk_icon_cache_new_for_path (const gchar *path) ...@@ -122,8 +122,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
/* Verify cache is uptodate */ /* Verify cache is uptodate */
if (st.st_mtime < path_st.st_mtime) if (st.st_mtime < path_st.st_mtime)
{ {
GTK_NOTE (ICONTHEME, GTK_NOTE (ICONTHEME, g_print ("cache outdated\n"));
g_print ("cache outdated\n"));
goto done; goto done;
} }
...@@ -133,7 +132,7 @@ _gtk_icon_cache_new_for_path (const gchar *path) ...@@ -133,7 +132,7 @@ _gtk_icon_cache_new_for_path (const gchar *path)
goto done; goto done;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_ICONTHEME) if (GTK_DEBUG_CHECK (ICONTHEME))
{ {
CacheInfo info; CacheInfo info;
......
...@@ -185,7 +185,7 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache, ...@@ -185,7 +185,7 @@ _gtk_pixel_cache_create_surface_if_needed (GtkPixelCache *cache,
double red, green, blue, alpha; double red, green, blue, alpha;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_NO_PIXEL_CACHE) if (GTK_DEBUG_CHECK (NO_PIXEL_CACHE))
return; return;
#endif #endif
...@@ -363,7 +363,7 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache, ...@@ -363,7 +363,7 @@ _gtk_pixel_cache_repaint (GtkPixelCache *cache,
cairo_restore (backing_cr); cairo_restore (backing_cr);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_PIXEL_CACHE) if (GTK_DEBUG_CHECK (PIXEL_CACHE))
{ {
GdkRGBA colors[] = { GdkRGBA colors[] = {
{ 1, 0, 0, 0.08}, { 1, 0, 0, 0.08},
......
...@@ -489,9 +489,10 @@ gtk_print_job_get_surface (GtkPrintJob *job, ...@@ -489,9 +489,10 @@ gtk_print_job_get_surface (GtkPrintJob *job,
fchmod (fd, S_IRUSR | S_IWUSR); fchmod (fd, S_IRUSR | S_IWUSR);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
/* If we are debugging printing don't delete the tmp files */ /* If we are debugging printing don't delete the tmp files */
if (!(gtk_get_debug_flags () & GTK_DEBUG_PRINTING)) if (GTK_DEBUG_CHECK (PRINTING)) ;
else
#endif /* G_ENABLE_DEBUG */ #endif /* G_ENABLE_DEBUG */
g_unlink (filename); g_unlink (filename);
g_free (filename); g_free (filename);
......
...@@ -35,7 +35,7 @@ static inline void _fixup_validation (GtkRBTree *tree, ...@@ -35,7 +35,7 @@ static inline void _fixup_validation (GtkRBTree *tree,
GtkRBNode *node); GtkRBNode *node);
static inline void _fixup_total_count (GtkRBTree *tree, static inline void _fixup_total_count (GtkRBTree *tree,
GtkRBNode *node); GtkRBNode *node);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
static void _gtk_rbtree_test (const gchar *where, static void _gtk_rbtree_test (const gchar *where,
GtkRBTree *tree); GtkRBTree *tree);
static void _gtk_rbtree_debug_spew (GtkRBTree *tree); static void _gtk_rbtree_debug_spew (GtkRBTree *tree);
...@@ -74,7 +74,7 @@ static void ...@@ -74,7 +74,7 @@ static void
_gtk_rbnode_free (GtkRBNode *node) _gtk_rbnode_free (GtkRBNode *node)
{ {
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
node->left = (gpointer) 0xdeadbeef; node->left = (gpointer) 0xdeadbeef;
node->right = (gpointer) 0xdeadbeef; node->right = (gpointer) 0xdeadbeef;
...@@ -391,10 +391,10 @@ gtk_rbnode_adjust (GtkRBTree *tree, ...@@ -391,10 +391,10 @@ gtk_rbnode_adjust (GtkRBTree *tree,
void void
_gtk_rbtree_remove (GtkRBTree *tree) _gtk_rbtree_remove (GtkRBTree *tree)
{ {
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
GtkRBTree *tmp_tree; GtkRBTree *tmp_tree;
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
#endif #endif
...@@ -408,14 +408,14 @@ _gtk_rbtree_remove (GtkRBTree *tree) ...@@ -408,14 +408,14 @@ _gtk_rbtree_remove (GtkRBTree *tree)
- (int) tree->root->total_count, - (int) tree->root->total_count,
- tree->root->offset); - tree->root->offset);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
tmp_tree = tree->parent_tree; tmp_tree = tree->parent_tree;
#endif #endif
_gtk_rbtree_free (tree); _gtk_rbtree_free (tree);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
_gtk_rbtree_test (G_STRLOC, tmp_tree); _gtk_rbtree_test (G_STRLOC, tmp_tree);
#endif #endif
} }
...@@ -430,14 +430,14 @@ _gtk_rbtree_insert_after (GtkRBTree *tree, ...@@ -430,14 +430,14 @@ _gtk_rbtree_insert_after (GtkRBTree *tree,
GtkRBNode *node; GtkRBNode *node;
gboolean right = TRUE; gboolean right = TRUE;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_print ("\n\n_gtk_rbtree_insert_after: %p\n", current); g_print ("\n\n_gtk_rbtree_insert_after: %p\n", current);
_gtk_rbtree_debug_spew (tree); _gtk_rbtree_debug_spew (tree);
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
} }
#endif /* G_ENABLE_DEBUG */ #endif
if (current != NULL && !_gtk_rbtree_is_nil (current->right)) if (current != NULL && !_gtk_rbtree_is_nil (current->right))
{ {
...@@ -475,15 +475,15 @@ _gtk_rbtree_insert_after (GtkRBTree *tree, ...@@ -475,15 +475,15 @@ _gtk_rbtree_insert_after (GtkRBTree *tree,
_gtk_rbtree_insert_fixup (tree, node); _gtk_rbtree_insert_fixup (tree, node);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_print ("_gtk_rbtree_insert_after finished...\n"); g_print ("_gtk_rbtree_insert_after finished...\n");
_gtk_rbtree_debug_spew (tree); _gtk_rbtree_debug_spew (tree);
g_print ("\n\n"); g_print ("\n\n");
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
} }
#endif /* G_ENABLE_DEBUG */ #endif
return node; return node;
} }
...@@ -497,15 +497,15 @@ _gtk_rbtree_insert_before (GtkRBTree *tree, ...@@ -497,15 +497,15 @@ _gtk_rbtree_insert_before (GtkRBTree *tree,
GtkRBNode *node; GtkRBNode *node;
gboolean left = TRUE; gboolean left = TRUE;
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_print ("\n\n_gtk_rbtree_insert_before: %p\n", current); g_print ("\n\n_gtk_rbtree_insert_before: %p\n", current);
_gtk_rbtree_debug_spew (tree); _gtk_rbtree_debug_spew (tree);
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
} }
#endif /* G_ENABLE_DEBUG */ #endif
if (current != NULL && !_gtk_rbtree_is_nil (current->left)) if (current != NULL && !_gtk_rbtree_is_nil (current->left))
{ {
current = current->left; current = current->left;
...@@ -543,16 +543,16 @@ _gtk_rbtree_insert_before (GtkRBTree *tree, ...@@ -543,16 +543,16 @@ _gtk_rbtree_insert_before (GtkRBTree *tree,
_gtk_rbtree_insert_fixup (tree, node); _gtk_rbtree_insert_fixup (tree, node);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_print ("_gtk_rbtree_insert_before finished...\n"); g_print ("_gtk_rbtree_insert_before finished...\n");
_gtk_rbtree_debug_spew (tree); _gtk_rbtree_debug_spew (tree);
g_print ("\n\n"); g_print ("\n\n");
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
} }
#endif /* G_ENABLE_DEBUG */ #endif
return node; return node;
} }
...@@ -590,8 +590,8 @@ _gtk_rbtree_node_set_height (GtkRBTree *tree, ...@@ -590,8 +590,8 @@ _gtk_rbtree_node_set_height (GtkRBTree *tree,
gtk_rbnode_adjust (tree, node, 0, 0, diff); gtk_rbnode_adjust (tree, node, 0, 0, diff);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
#endif #endif
} }
...@@ -1117,21 +1117,21 @@ _gtk_rbtree_remove_node (GtkRBTree *tree, ...@@ -1117,21 +1117,21 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_print ("\n\n_gtk_rbtree_remove_node: %p\n", node); g_print ("\n\n_gtk_rbtree_remove_node: %p\n", node);
_gtk_rbtree_debug_spew (tree); _gtk_rbtree_debug_spew (tree);
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
} }
#endif /* G_ENABLE_DEBUG */ #endif
/* make sure we're deleting a node that's actually in the tree */ /* make sure we're deleting a node that's actually in the tree */
for (x = node; !_gtk_rbtree_is_nil (x->parent); x = x->parent) for (x = node; !_gtk_rbtree_is_nil (x->parent); x = x->parent)
; ;
g_return_if_fail (x == tree->root); g_return_if_fail (x == tree->root);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
#endif #endif
...@@ -1226,15 +1226,15 @@ _gtk_rbtree_remove_node (GtkRBTree *tree, ...@@ -1226,15 +1226,15 @@ _gtk_rbtree_remove_node (GtkRBTree *tree,
_gtk_rbnode_free (node); _gtk_rbnode_free (node);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_print ("_gtk_rbtree_remove_node finished...\n"); g_print ("_gtk_rbtree_remove_node finished...\n");
_gtk_rbtree_debug_spew (tree); _gtk_rbtree_debug_spew (tree);
g_print ("\n\n"); g_print ("\n\n");
_gtk_rbtree_test (G_STRLOC, tree); _gtk_rbtree_test (G_STRLOC, tree);
} }
#endif /* G_ENABLE_DEBUG */ #endif
} }
GtkRBNode * GtkRBNode *
......
...@@ -754,10 +754,12 @@ _gtk_text_btree_delete (GtkTextIter *start, ...@@ -754,10 +754,12 @@ _gtk_text_btree_delete (GtkTextIter *start,
gtk_text_iter_order (start, end); gtk_text_iter_order (start, end);
tree = _gtk_text_iter_get_btree (start); tree = _gtk_text_iter_get_btree (start);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
/* Broadcast the need for redisplay before we break the iterators */ /* Broadcast the need for redisplay before we break the iterators */
DV (g_print ("invalidating due to deleting some text (%s)\n", G_STRLOC)); DV (g_print ("invalidating due to deleting some text (%s)\n", G_STRLOC));
_gtk_text_btree_invalidate_region (tree, start, end, FALSE); _gtk_text_btree_invalidate_region (tree, start, end, FALSE);
...@@ -1077,8 +1079,10 @@ _gtk_text_btree_delete (GtkTextIter *start, ...@@ -1077,8 +1079,10 @@ _gtk_text_btree_delete (GtkTextIter *start,
chars_changed (tree); chars_changed (tree);
segments_changed (tree); segments_changed (tree);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
/* Re-initialize our iterators */ /* Re-initialize our iterators */
_gtk_text_btree_get_iter_at_line (tree, start, start_line, start_byte_offset); _gtk_text_btree_get_iter_at_line (tree, start, start_line, start_byte_offset);
...@@ -1359,8 +1363,10 @@ find_line_by_y (GtkTextBTree *tree, BTreeView *view, ...@@ -1359,8 +1363,10 @@ find_line_by_y (GtkTextBTree *tree, BTreeView *view,
{ {
gint current_y = 0; gint current_y = 0;
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
if (node->level == 0) if (node->level == 0)
{ {
...@@ -2011,8 +2017,10 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig, ...@@ -2011,8 +2017,10 @@ _gtk_text_btree_tag (const GtkTextIter *start_orig,
queue_tag_redisplay (tree, tag, &start, &end); queue_tag_redisplay (tree, tag, &start, &end);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
} }
...@@ -2736,9 +2744,11 @@ real_set_mark (GtkTextBTree *tree, ...@@ -2736,9 +2744,11 @@ real_set_mark (GtkTextBTree *tree,
iter = *where; iter = *where;
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_iter_check (&iter); _gtk_text_iter_check (&iter);
#endif
if (mark != NULL) if (mark != NULL)
{ {
if (redraw_selections && if (redraw_selections &&
...@@ -2793,9 +2803,11 @@ real_set_mark (GtkTextBTree *tree, ...@@ -2793,9 +2803,11 @@ real_set_mark (GtkTextBTree *tree,
mark); mark);
} }
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_iter_check (&iter); _gtk_text_iter_check (&iter);
#endif
/* Link mark into new location */ /* Link mark into new location */
gtk_text_btree_link_segment (mark, &iter); gtk_text_btree_link_segment (mark, &iter);
...@@ -2808,12 +2820,14 @@ real_set_mark (GtkTextBTree *tree, ...@@ -2808,12 +2820,14 @@ real_set_mark (GtkTextBTree *tree,
redisplay_mark_if_visible (mark); redisplay_mark_if_visible (mark);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
_gtk_text_iter_check (&iter); if (GTK_DEBUG_CHECK (TEXT))
{
_gtk_text_iter_check (&iter);
_gtk_text_btree_check (tree);
}
#endif
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT)
_gtk_text_btree_check (tree);
return mark; return mark;
} }
...@@ -4329,8 +4343,10 @@ _gtk_text_line_next_could_contain_tag (GtkTextLine *line, ...@@ -4329,8 +4343,10 @@ _gtk_text_line_next_could_contain_tag (GtkTextLine *line,
g_return_val_if_fail (line != NULL, NULL); g_return_val_if_fail (line != NULL, NULL);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
if (tag == NULL) if (tag == NULL)
{ {
...@@ -4492,8 +4508,10 @@ _gtk_text_line_previous_could_contain_tag (GtkTextLine *line, ...@@ -4492,8 +4508,10 @@ _gtk_text_line_previous_could_contain_tag (GtkTextLine *line,
g_return_val_if_fail (line != NULL, NULL); g_return_val_if_fail (line != NULL, NULL);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
if (tag == NULL) if (tag == NULL)
{ {
...@@ -5264,8 +5282,10 @@ _gtk_text_btree_validate (GtkTextBTree *tree, ...@@ -5264,8 +5282,10 @@ _gtk_text_btree_validate (GtkTextBTree *tree,
if (new_height) if (new_height)
*new_height = state.new_height; *new_height = state.new_height;
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
return TRUE; return TRUE;
} }
...@@ -5973,8 +5993,10 @@ post_insert_fixup (GtkTextBTree *tree, ...@@ -5973,8 +5993,10 @@ post_insert_fixup (GtkTextBTree *tree,
gtk_text_btree_rebalance (tree, node); gtk_text_btree_rebalance (tree, node);
} }
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
} }
static GtkTextTagInfo* static GtkTextTagInfo*
...@@ -6539,8 +6561,10 @@ gtk_text_btree_link_segment (GtkTextLineSegment *seg, ...@@ -6539,8 +6561,10 @@ gtk_text_btree_link_segment (GtkTextLineSegment *seg,
cleanup_line (line); cleanup_line (line);
segments_changed (tree); segments_changed (tree);
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_btree_check (tree); _gtk_text_btree_check (tree);
#endif
} }
static void static void
...@@ -6634,7 +6658,7 @@ _gtk_toggle_segment_check_func (GtkTextLineSegment *segPtr, ...@@ -6634,7 +6658,7 @@ _gtk_toggle_segment_check_func (GtkTextLineSegment *segPtr,
/* /*
* Debug * Debug
*/ */
#ifdef G_ENABLE_DEBUG
static void static void
gtk_text_btree_node_view_check_consistency (GtkTextBTree *tree, gtk_text_btree_node_view_check_consistency (GtkTextBTree *tree,
GtkTextBTreeNode *node, GtkTextBTreeNode *node,
...@@ -7081,6 +7105,7 @@ _gtk_text_btree_check (GtkTextBTree *tree) ...@@ -7081,6 +7105,7 @@ _gtk_text_btree_check (GtkTextBTree *tree)
seg->body.chars); seg->body.chars);
} }
} }
#endif /* G_ENABLE_DEBUG */
void _gtk_text_btree_spew_line (GtkTextBTree* tree, GtkTextLine* line); void _gtk_text_btree_spew_line (GtkTextBTree* tree, GtkTextLine* line);
void _gtk_text_btree_spew_segment (GtkTextBTree* tree, GtkTextLineSegment* seg); void _gtk_text_btree_spew_segment (GtkTextBTree* tree, GtkTextLineSegment* seg);
......
...@@ -369,7 +369,7 @@ is_segment_start (GtkTextRealIter *real) ...@@ -369,7 +369,7 @@ is_segment_start (GtkTextRealIter *real)
static void static void
check_invariants (const GtkTextIter *iter) check_invariants (const GtkTextIter *iter)
{ {
if (gtk_get_debug_flags () & GTK_DEBUG_TEXT) if (GTK_DEBUG_CHECK (TEXT))
_gtk_text_iter_check (iter); _gtk_text_iter_check (iter);
} }
#else #else
......
...@@ -6042,8 +6042,10 @@ cursor_blinks (GtkTextView *text_view) ...@@ -6042,8 +6042,10 @@ cursor_blinks (GtkTextView *text_view)
#ifdef DEBUG_VALIDATION_AND_SCROLLING #ifdef DEBUG_VALIDATION_AND_SCROLLING
return FALSE; return FALSE;
#endif #endif
if (gtk_get_debug_flags () & GTK_DEBUG_UPDATES) #ifdef G_ENABLE_DEBUG
if (GTK_DEBUG_CHECK (UPDATES))
return FALSE; return FALSE;
#endif
g_object_get (settings, "gtk-cursor-blink", &blink, NULL); g_object_get (settings, "gtk-cursor-blink", &blink, NULL);
......
...@@ -192,16 +192,19 @@ static void gtk_tree_store_move (GtkTreeStore * ...@@ -192,16 +192,19 @@ static void gtk_tree_store_move (GtkTreeStore *
gboolean before); gboolean before);
#ifdef G_ENABLE_DEBUG
static inline void static inline void
validate_tree (GtkTreeStore *tree_store) validate_tree (GtkTreeStore *tree_store)
{ {
if (gtk_get_debug_flags () & GTK_DEBUG_TREE) if (GTK_DEBUG_CHECK (TREE))
{ {
g_assert (G_NODE (tree_store->priv->root)->parent == NULL); g_assert (G_NODE (tree_store->priv->root)->parent == NULL);
validate_gnode (G_NODE (tree_store->priv->root)); validate_gnode (G_NODE (tree_store->priv->root));
} }
} }
#else
#define validate_tree(store)
#endif
G_DEFINE_TYPE_WITH_CODE (GtkTreeStore, gtk_tree_store, G_TYPE_OBJECT, G_DEFINE_TYPE_WITH_CODE (GtkTreeStore, gtk_tree_store, G_TYPE_OBJECT,
G_ADD_PRIVATE (GtkTreeStore) G_ADD_PRIVATE (GtkTreeStore)
......
...@@ -5839,7 +5839,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget, ...@@ -5839,7 +5839,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
gtk_widget_push_verify_invariants (widget); gtk_widget_push_verify_invariants (widget);
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_GEOMETRY) if (GTK_DEBUG_CHECK (GEOMETRY))
{ {
gint depth; gint depth;
GtkWidget *parent; GtkWidget *parent;
...@@ -5901,7 +5901,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget, ...@@ -5901,7 +5901,7 @@ gtk_widget_size_allocate_with_baseline (GtkWidget *widget,
} }
#ifdef G_ENABLE_DEBUG #ifdef G_ENABLE_DEBUG
if (gtk_get_debug_flags () & GTK_DEBUG_GEOMETRY) if (GTK_DEBUG_CHECK (GEOMETRY))
{ {