[gtksourceview] Fix coding style for previous commits



commit 7dfbd9c5cd418f46db2d58632440902f67315fda
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Apr 24 18:30:05 2016 +0200

    Fix coding style for previous commits
    
    Booleans should not be compared explicitly with TRUE or FALSE, that's
    the only type where it is redundant.
    
    For every non-static function, we check the parameters with g_returns,
    for more robustness and ease of fixing (maintenance).

 gtksourceview/gtksourcetag.c  |    2 ++
 gtksourceview/gtksourceview.c |   16 ++++++++--------
 2 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/gtksourcetag.c b/gtksourceview/gtksourcetag.c
index 7603b21..3c33fe7 100644
--- a/gtksourceview/gtksourcetag.c
+++ b/gtksourceview/gtksourcetag.c
@@ -191,6 +191,8 @@ _gtk_source_tag_effects_spaces (GtkSourceTag *tag)
 {
        GtkSourceTagPrivate *priv;
 
+       g_return_val_if_fail (GTK_SOURCE_IS_TAG (tag), FALSE);
+
        priv = gtk_source_tag_get_instance_private (tag);
 
        return priv->draw_spaces_set && priv->draw_spaces;
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 3b58ab6..8ac3f56 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2448,15 +2448,15 @@ static void
 draw_spaces_tag_foreach (GtkTextTag *tag,
                         gboolean   *found)
 {
-       if (*found == FALSE)
+       if (*found)
        {
-               if (GTK_SOURCE_IS_TAG (tag))
-               {
-                       if (_gtk_source_tag_effects_spaces (GTK_SOURCE_TAG (tag)))
-                       {
-                               *found = TRUE;
-                       }
-               }
+               return;
+       }
+
+       if (GTK_SOURCE_IS_TAG (tag) &&
+           _gtk_source_tag_effects_spaces (GTK_SOURCE_TAG (tag)))
+       {
+               *found = TRUE;
        }
 }
 


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