[empathy: 49/80] Use a for instead of a do while to avoid returning early
- From: Emilio Pozuelo Monfort <epm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [empathy: 49/80] Use a for instead of a do while to avoid returning early
- Date: Fri, 10 Jun 2011 08:43:16 +0000 (UTC)
commit 652f53c7969e0df0ce9c1fa9b01fb2993f270121
Author: Emilio Pozuelo Monfort <emilio pozuelo collabora co uk>
Date: Wed Apr 27 11:07:07 2011 +0100
Use a for instead of a do while to avoid returning early
So we always free the stuff at the end of the function.
libempathy-gtk/empathy-log-window.c | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/libempathy-gtk/empathy-log-window.c b/libempathy-gtk/empathy-log-window.c
index 5168818..b6531ff 100644
--- a/libempathy-gtk/empathy-log-window.c
+++ b/libempathy-gtk/empathy-log-window.c
@@ -1892,15 +1892,15 @@ log_window_chats_set_selected (EmpathyLogWindow *window)
GtkTreeSelection *selection;
GtkTreeIter iter;
GtkTreePath *path;
+ gboolean next;
view = GTK_TREE_VIEW (window->treeview_who);
model = gtk_tree_view_get_model (view);
selection = gtk_tree_view_get_selection (view);
- if (!gtk_tree_model_get_iter_first (model, &iter))
- return;
-
- do
+ for (next = gtk_tree_model_get_iter_first (model, &iter);
+ next;
+ next = gtk_tree_model_iter_next (model, &iter))
{
TpAccount *this_account;
TplEntity *this_target;
@@ -1932,7 +1932,6 @@ log_window_chats_set_selected (EmpathyLogWindow *window)
g_object_unref (this_account);
g_object_unref (this_target);
}
- while (gtk_tree_model_iter_next (model, &iter));
tp_clear_object (&window->selected_account);
tp_clear_pointer (&window->selected_chat_id, g_free);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]