[Xfce4-commits] <midori:master> Remove redundant array NULL checks

Christian Dywan noreply at xfce.org
Tue Nov 27 01:26:01 CET 2012


Updating branch refs/heads/master
         to 276d64556ee7f45da724381772fd508f179ac623 (commit)
       from 84bedf71bd18d76b3690d65c64969848a95b21be (commit)

commit 276d64556ee7f45da724381772fd508f179ac623
Author: Christian Dywan <christian at twotoasts.de>
Date:   Tue Nov 27 01:21:28 2012 +0100

    Remove redundant array NULL checks

 midori/midori-array.c   |    3 +--
 midori/midori-browser.c |   11 -----------
 2 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/midori/midori-array.c b/midori/midori-array.c
index 1fcd3d8..960a800 100644
--- a/midori/midori-array.c
+++ b/midori/midori-array.c
@@ -1101,8 +1101,7 @@ midori_array_query_recursive (KatzeArray*  bookmarks,
     g_return_val_if_fail (fields, NULL);
     g_return_val_if_fail (condition, NULL);
     db = g_object_get_data (G_OBJECT (bookmarks), "db");
-    if (db == NULL)
-        return NULL;
+    g_return_val_if_fail (db != NULL, NULL);
 
     sqlcmd = g_strdup_printf ("SELECT %s FROM bookmarks WHERE %s "
                               "ORDER BY (uri='') ASC, title DESC", fields, condition);
diff --git a/midori/midori-browser.c b/midori/midori-browser.c
index d8f239b..ec12583 100644
--- a/midori/midori-browser.c
+++ b/midori/midori-browser.c
@@ -3070,10 +3070,7 @@ _action_bookmarks_populate_folder (GtkAction*     action,
     {
         if (!(bookmarks = midori_array_query (browser->bookmarks,
           "id, title, parentid, uri, app, pos_panel, pos_bar", "parentid is NULL", NULL)))
-        {
-            g_warning ("midori_array_query returned NULL)");
             return FALSE;
-        }
     }
     else
     {
@@ -3082,7 +3079,6 @@ _action_bookmarks_populate_folder (GtkAction*     action,
         if (!(bookmarks = midori_array_query (browser->bookmarks,
               "id, title, parentid, uri, app, pos_panel, pos_bar", "parentid = %q", parentid)))
         {
-            g_warning ("midori_array_query returned NULL (id='%s')", parentid);
             g_free (parentid);
             return FALSE;
         }
@@ -7185,7 +7181,6 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
         "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "toolbar = 1", NULL);
     if (!array)
     {
-        g_warning ("midori_array_query returned NULL");
         _action_set_sensitive (browser, "BookmarkAdd", FALSE);
         _action_set_sensitive (browser, "BookmarkFolderAdd", FALSE);
         return;
@@ -7203,15 +7198,9 @@ midori_bookmarkbar_populate (MidoriBrowser* browser)
                 "id, parentid, title, uri, desc, app, toolbar, pos_panel, pos_bar", "parentid = %q AND uri != ''",
                 parentid);
 
-            if (subfolder)
-            {
                 katze_item_set_name (KATZE_ITEM (subfolder), katze_item_get_name (item));
                 katze_item_set_meta_integer (KATZE_ITEM (subfolder), "id", id);
                 midori_bookmarkbar_insert_item (browser->bookmarkbar, KATZE_ITEM (subfolder));
-            }
-            else
-                g_warning ("midori_array_query returned NULL (id='%s')", parentid);
-
             g_free (parentid);
         }
     }


More information about the Xfce4-commits mailing list