[Telepathy-commits] [telepathy-gabble/master] _gabble_roster_item_update: eliminate unnecessary temporary, old_groups

Simon McVittie simon.mcvittie at collabora.co.uk
Tue Aug 19 10:51:49 PDT 2008


old_groups is slightly misleadingly named - it's a direct pointer to the intset
underlying item->groups, so its contents change whenever item->groups does.
(In practice we only used it once, before making any changes.)

20080423131743-53eee-0b3aeadd3136517c2ae4267c440ed2146d1c1110.gz
---
 src/roster.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/roster.c b/src/roster.c
index 469e35f..895c829 100644
--- a/src/roster.c
+++ b/src/roster.c
@@ -586,7 +586,7 @@ _gabble_roster_item_update (GabbleRoster *roster,
       (TpBaseConnection *)priv->conn, TP_HANDLE_TYPE_CONTACT);
   GabbleRosterItem *item;
   const gchar *ask, *name;
-  TpIntSet *old_groups, *new_groups, *added_to, *removed_from, *removed_from2;
+  TpIntSet *new_groups, *added_to, *removed_from, *removed_from2;
   TpHandleSet *new_groups_handle_set;
   GroupsUpdateContext ctx = { group_updates, contact_handle };
 
@@ -642,12 +642,12 @@ _gabble_roster_item_update (GabbleRoster *roster,
           contact_handle);
     }
 
-  old_groups = tp_handle_set_peek (item->groups);    /* borrowed */
   new_groups_handle_set = _parse_item_groups (node,
       (TpBaseConnection *)priv->conn);
   new_groups = tp_handle_set_peek (new_groups_handle_set);
 
-  removed_from = tp_intset_difference (old_groups, new_groups);
+  removed_from = tp_intset_difference (tp_handle_set_peek (item->groups),
+      new_groups);
   added_to = tp_handle_set_update (item->groups, new_groups);
   removed_from2 = tp_handle_set_difference_update (item->groups, removed_from);
 
-- 
1.5.6.3




More information about the Telepathy-commits mailing list