Commit 10cb529f authored by John Sullivan's avatar John Sullivan

Just improved the quantity and quality of g_return_if_fail calls.

parent 17a18859
1999-12-28 John Sullivan <sullivan@eazel.com>
* src/nautilus-bookmark.c:
* src/nautilus-bookmarklist.c:
* src/nautilus-bookmarks-menu.c:
Removed unnecessary g_return_if_fail (obj != NULL) calls
since the g_return_if_fail (NAUTILUS_IS_WHATEVER (obj)) call
also handles the NULL case. Also added some more calls of
the latter type.
1999-12-28 John Sullivan <sullivan@eazel.com>
* src/nautilus-bookmark.[ch]: (nautilus_bookmark_compare_with):
......
......@@ -35,7 +35,6 @@ nautilus_bookmark_destroy (GtkObject *object)
{
NautilusBookmark *bookmark;
g_return_if_fail(object != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARK (object));
bookmark = NAUTILUS_BOOKMARK(object);
......@@ -121,8 +120,8 @@ nautilus_bookmark_compare_with (gconstpointer a, gconstpointer b)
NautilusBookmark *bookmark_a;
NautilusBookmark *bookmark_b;
g_return_val_if_fail(NAUTILUS_IS_BOOKMARK(a), FALSE);
g_return_val_if_fail(NAUTILUS_IS_BOOKMARK(b), FALSE);
g_return_val_if_fail(NAUTILUS_IS_BOOKMARK(a), 1);
g_return_val_if_fail(NAUTILUS_IS_BOOKMARK(b), 1);
bookmark_a = NAUTILUS_BOOKMARK(a);
bookmark_b = NAUTILUS_BOOKMARK(b);
......@@ -145,12 +144,16 @@ nautilus_bookmark_compare_with (gconstpointer a, gconstpointer b)
const gchar *
nautilus_bookmark_get_name (const NautilusBookmark *bookmark)
{
g_return_val_if_fail(NAUTILUS_IS_BOOKMARK (bookmark), NULL);
return bookmark->name->str;
}
const gchar *
nautilus_bookmark_get_uri (const NautilusBookmark *bookmark)
{
g_return_val_if_fail(NAUTILUS_IS_BOOKMARK (bookmark), NULL);
return bookmark->uri->str;
}
......
......@@ -120,6 +120,9 @@ nautilus_bookmarklist_append (NautilusBookmarklist *bookmarks,
{
NautilusBookmark *new_bookmark;
g_return_if_fail (NAUTILUS_IS_BOOKMARKLIST (bookmarks));
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
new_bookmark = nautilus_bookmark_new(
nautilus_bookmark_get_name(bookmark),
nautilus_bookmark_get_uri(bookmark));
......@@ -141,6 +144,9 @@ gboolean
nautilus_bookmarklist_contains (NautilusBookmarklist *bookmarks,
const NautilusBookmark *bookmark)
{
g_return_if_fail (NAUTILUS_IS_BOOKMARKLIST (bookmarks));
g_return_if_fail (NAUTILUS_IS_BOOKMARK (bookmark));
return g_list_find_custom(bookmarks->list,
(gpointer)bookmark,
nautilus_bookmark_compare_with)
......@@ -156,7 +162,6 @@ nautilus_bookmarklist_contains (NautilusBookmarklist *bookmarks,
void
nautilus_bookmarklist_contents_changed(NautilusBookmarklist *bookmarks)
{
g_return_if_fail (bookmarks != NULL);
g_return_if_fail (NAUTILUS_IS_BOOKMARKLIST (bookmarks));
gtk_signal_emit(GTK_OBJECT (bookmarks),
......@@ -175,7 +180,6 @@ nautilus_bookmarklist_contents_changed(NautilusBookmarklist *bookmarks)
const NautilusBookmark *
nautilus_bookmarklist_item_at (NautilusBookmarklist *bookmarks, guint index)
{
g_return_val_if_fail(bookmarks != NULL, NULL);
g_return_val_if_fail(NAUTILUS_IS_BOOKMARKLIST(bookmarks), NULL);
g_return_val_if_fail(index < g_list_length(bookmarks->list), NULL);
......@@ -193,7 +197,6 @@ nautilus_bookmarklist_item_at (NautilusBookmarklist *bookmarks, guint index)
guint
nautilus_bookmarklist_length (NautilusBookmarklist *bookmarks)
{
g_return_val_if_fail(bookmarks != NULL, 0);
g_return_val_if_fail(NAUTILUS_IS_BOOKMARKLIST(bookmarks), 0);
return g_list_length(bookmarks->list);
......
......@@ -128,7 +128,6 @@ add_bookmark_cb(GtkMenuItem* item, gpointer func_data)
NautilusBookmark *bookmark;
const char* current_uri;
g_return_if_fail(func_data != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARKS_MENU (func_data));
bookmarks_menu = NAUTILUS_BOOKMARKS_MENU (func_data);
......@@ -151,9 +150,7 @@ bookmark_activated_cb(GtkMenuItem* item, gpointer func_data)
NautilusWindow *window;
NautilusBookmark *bookmark;
g_return_if_fail(gtk_object_get_data(GTK_OBJECT(item), WINDOW_TO_UPDATE) != NULL);
g_return_if_fail(NAUTILUS_IS_WINDOW(gtk_object_get_data(GTK_OBJECT(item), WINDOW_TO_UPDATE)));
g_return_if_fail(func_data != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARK (func_data));
window = NAUTILUS_WINDOW(gtk_object_get_data(GTK_OBJECT(item), WINDOW_TO_UPDATE));
......@@ -173,9 +170,7 @@ list_changed_cb(NautilusBookmarklist *bookmarks, gpointer data)
{
NautilusBookmarksMenu *menu;
g_return_if_fail(bookmarks != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARKLIST(bookmarks));
g_return_if_fail(data != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARKS_MENU(data));
menu = NAUTILUS_BOOKMARKS_MENU(data);
......@@ -210,7 +205,6 @@ nautilus_bookmarks_menu_get_type (void)
static void
nautilus_bookmarks_menu_append(NautilusBookmarksMenu *bookmarks_menu, GtkWidget *item)
{
g_return_if_fail(bookmarks_menu != NULL);
g_return_if_fail(GTK_IS_MENU_ITEM(item));
gtk_widget_show(item);
......@@ -230,7 +224,6 @@ nautilus_bookmarks_menu_clear_bookmarks (NautilusBookmarksMenu *menu)
GList *iter;
gboolean found_dynamic_items;
g_return_if_fail(menu != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARKS_MENU(menu));
children = gtk_container_children(GTK_CONTAINER(menu));
......@@ -287,7 +280,6 @@ nautilus_bookmarks_menu_repopulate (NautilusBookmarksMenu *menu)
guint bookmark_count;
gint index;
g_return_if_fail(menu != NULL);
g_return_if_fail(NAUTILUS_IS_BOOKMARKS_MENU(menu));
nautilus_bookmarks_menu_clear_bookmarks(menu);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment