From 907466855462d2b04507256df263c19568e8cecd Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Mon, 7 May 2012 17:29:22 +0100 Subject: [PATCH 3/4] Use non-deprecated TpIntset APIs --- src/capabilities.c | 35 ++++++++++++++++++--------------- src/conn-olpc.c | 53 ++++++++++++++++++++++++++++++-------------------- src/media-channel.c | 8 ++++---- src/muc-channel.c | 18 ++++++++--------- src/muc-factory.c | 2 +- src/presence-cache.h | 2 +- src/roster.c | 36 +++++++++++++++++----------------- 7 files changed, 84 insertions(+), 70 deletions(-) diff --git a/src/capabilities.c b/src/capabilities.c index 14a396a..620e3a6 100644 --- a/src/capabilities.c +++ b/src/capabilities.c @@ -440,7 +440,7 @@ void gabble_capability_set_update (GabbleCapabilitySet *target, const GabbleCapabilitySet *source) { - TpIntSet *ret; + TpIntset *ret; g_return_if_fail (target != NULL); g_return_if_fail (source != NULL); @@ -600,16 +600,17 @@ gboolean gabble_capability_set_has_one (const GabbleCapabilitySet *caps, const GabbleCapabilitySet *alternatives) { - TpIntSetIter iter; + TpIntsetFastIter iter; + guint element; g_return_val_if_fail (caps != NULL, FALSE); g_return_val_if_fail (alternatives != NULL, FALSE); - tp_intset_iter_init (&iter, tp_handle_set_peek (alternatives->handles)); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (alternatives->handles)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - if (tp_handle_set_is_member (caps->handles, iter.element)) + if (tp_handle_set_is_member (caps->handles, element)) { return TRUE; } @@ -623,16 +624,17 @@ gboolean gabble_capability_set_at_least (const GabbleCapabilitySet *caps, const GabbleCapabilitySet *query) { - TpIntSetIter iter; + TpIntsetFastIter iter; + guint element; g_return_val_if_fail (caps != NULL, FALSE); g_return_val_if_fail (query != NULL, FALSE); - tp_intset_iter_init (&iter, tp_handle_set_peek (query->handles)); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (query->handles)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - if (!tp_handle_set_is_member (caps->handles, iter.element)) + if (!tp_handle_set_is_member (caps->handles, element)) { return FALSE; } @@ -657,16 +659,17 @@ void gabble_capability_set_foreach (const GabbleCapabilitySet *caps, GFunc func, gpointer user_data) { - TpIntSetIter iter; + TpIntsetFastIter iter; + guint element; g_return_if_fail (caps != NULL); g_return_if_fail (func != NULL); - tp_intset_iter_init (&iter, tp_handle_set_peek (caps->handles)); + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (caps->handles)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - const gchar *var = tp_handle_inspect (feature_handles, iter.element); + const gchar *var = tp_handle_inspect (feature_handles, element); g_return_if_fail (var != NULL); @@ -677,10 +680,10 @@ gabble_capability_set_foreach (const GabbleCapabilitySet *caps, static void append_intset (GString *ret, - const TpIntSet *cap_ints, + const TpIntset *cap_ints, const gchar *indent) { - TpIntSetFastIter iter; + TpIntsetFastIter iter; guint element; tp_intset_fast_iter_init (&iter, cap_ints); @@ -726,7 +729,7 @@ gabble_capability_set_dump_diff (const GabbleCapabilitySet *old_caps, const GabbleCapabilitySet *new_caps, const gchar *indent) { - TpIntSet *old_ints, *new_ints, *rem, *add; + TpIntset *old_ints, *new_ints, *rem, *add; GString *ret; g_return_val_if_fail (old_caps != NULL, NULL); diff --git a/src/conn-olpc.c b/src/conn-olpc.c index a935e9a..575c674 100644 --- a/src/conn-olpc.c +++ b/src/conn-olpc.c @@ -575,7 +575,7 @@ static GPtrArray * get_buddy_activities (GabbleConnection *conn, TpHandle buddy) { - TpIntSet *all; + TpIntset *all; gboolean free_all = FALSE; GPtrArray *activities = g_ptr_array_new (); TpHandleSet *invited_activities, *pep_activities; @@ -612,18 +612,21 @@ get_buddy_activities (GabbleConnection *conn, if (all != NULL) { - TpIntSetIter iter = TP_INTSET_ITER_INIT (all); + TpIntsetFastIter iter; + guint element; - while (tp_intset_iter_next (&iter)) + tp_intset_fast_iter_init (&iter, all); + + while (tp_intset_fast_iter_next (&iter, &element)) { GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (iter.element)); + conn->olpc_activities_info, GUINT_TO_POINTER (element)); GValue gvalue = { 0 }; g_assert (activity != NULL); if (activity->id == NULL) { - DEBUG ("... activity #%u has no ID, skipping", iter.element); + DEBUG ("... activity #%u has no ID, skipping", element); continue; } @@ -938,13 +941,15 @@ upload_activities_pep (GabbleConnection *conn, if (my_activities != NULL) { - TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek - (my_activities)); + TpIntsetFastIter iter; + guint element; + + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (my_activities)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (iter.element)); + conn->olpc_activities_info, GUINT_TO_POINTER (element)); WockyNode *activity_node; g_assert (activity != NULL); @@ -1680,13 +1685,15 @@ upload_activity_properties_pep (GabbleConnection *conn, if (my_activities != NULL) { - TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek - (my_activities)); + TpIntsetFastIter iter; + guint element; + + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (my_activities)); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { GabbleOlpcActivity *activity = g_hash_table_lookup ( - conn->olpc_activities_info, GUINT_TO_POINTER (iter.element)); + conn->olpc_activities_info, GUINT_TO_POINTER (element)); activity_info_contribute_properties (activity, publish, TRUE); } @@ -1793,12 +1800,14 @@ refresh_invitations (GabbleConnection *conn, if (invitees != NULL && tp_handle_set_size (invitees) > 0) { - TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek - (invitees)); + TpIntsetFastIter iter; + guint element; - while (tp_intset_iter_next (&iter)) + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (invitees)); + + while (tp_intset_fast_iter_next (&iter, &element)) { - const gchar *to = tp_handle_inspect (contact_repo, iter.element); + const gchar *to = tp_handle_inspect (contact_repo, element); WockyStanza *msg = wocky_stanza_build ( WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, NULL, to, NULL); @@ -2496,13 +2505,15 @@ revoke_invitations (GabbleConnection *conn, if (invitees != NULL && tp_handle_set_size (invitees) > 0) { - TpIntSetIter iter = TP_INTSET_ITER_INIT (tp_handle_set_peek - (invitees)); + TpIntsetFastIter iter; + guint element; + + tp_intset_fast_iter_init (&iter, tp_handle_set_peek (invitees)); DEBUG ("revoke invitations for activity %s", activity->id); - while (tp_intset_iter_next (&iter)) + while (tp_intset_fast_iter_next (&iter, &element)) { - const gchar *to = tp_handle_inspect (contact_repo, iter.element); + const gchar *to = tp_handle_inspect (contact_repo, element); WockyStanza *msg = wocky_stanza_build ( WOCKY_STANZA_TYPE_MESSAGE, WOCKY_STANZA_SUB_TYPE_NONE, NULL, to, diff --git a/src/media-channel.c b/src/media-channel.c index 4449c92..f4f15d4 100644 --- a/src/media-channel.c +++ b/src/media-channel.c @@ -329,7 +329,7 @@ gabble_media_channel_constructor (GType type, guint n_props, GabbleMediaChannelPrivate *priv; TpBaseConnection *conn; TpDBusDaemon *bus; - TpIntSet *set; + TpIntset *set; TpHandleRepoIface *contact_handles; GabbleJingleInfo *ji; const gchar *relay_token; @@ -2100,7 +2100,7 @@ gabble_media_channel_add_member (GObject *obj, GabbleMediaChannel *chan = GABBLE_MEDIA_CHANNEL (obj); GabbleMediaChannelPrivate *priv = chan->priv; TpGroupMixin *mixin = TP_GROUP_MIXIN (obj); - TpIntSet *set; + TpIntset *set; /* did we create this channel? */ if (priv->creator == mixin->self_handle) @@ -2358,7 +2358,7 @@ session_terminated_cb (GabbleJingleSession *session, TpGroupMixin *mixin = TP_GROUP_MIXIN (channel); guint terminator; JingleState state; - TpIntSet *set; + TpIntset *set; DEBUG ("called"); @@ -2445,7 +2445,7 @@ session_state_changed_cb (GabbleJingleSession *session, GabbleMediaChannelPrivate *priv = channel->priv; TpGroupMixin *mixin = TP_GROUP_MIXIN (channel); JingleState state; - TpIntSet *set; + TpIntset *set; DEBUG ("called"); diff --git a/src/muc-channel.c b/src/muc-channel.c index 76c50e2..f708e35 100644 --- a/src/muc-channel.c +++ b/src/muc-channel.c @@ -492,8 +492,8 @@ gabble_muc_channel_constructed (GObject *obj) if (priv->invited) { /* invited: add ourself to local pending and the inviter to members */ - TpIntSet *members = tp_intset_new_containing (initiator); - TpIntSet *pending = tp_intset_new_containing (self_handle); + TpIntset *members = tp_intset_new_containing (initiator); + TpIntset *pending = tp_intset_new_containing (self_handle); tp_group_mixin_change_members (obj, priv->invitation_message, members, NULL, pending, NULL, @@ -1471,7 +1471,7 @@ close_channel (GabbleMucChannel *chan, const gchar *reason, GabbleMucChannelPrivate *priv = chan->priv; GabbleConnection *conn = GABBLE_CONNECTION ( tp_base_channel_get_connection (base)); - TpIntSet *set; + TpIntset *set; GArray *handles; GError error = { TP_ERROR, TP_ERROR_CANCELLED, "Muc channel closed below us" }; @@ -1553,7 +1553,7 @@ handle_nick_conflict (GabbleMucChannel *chan, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( tp_base_channel_get_connection (base), TP_HANDLE_TYPE_CONTACT); TpHandle self_handle; - TpIntSet *add_rp, *remove_rp; + TpIntset *add_rp, *remove_rp; const gchar *from = wocky_stanza_get_from (stanza); /* If this is a nick conflict message with a resource in the JID, and the @@ -1954,7 +1954,7 @@ handle_parted (GObject *source, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (tp_base_channel_get_connection (base), TP_HANDLE_TYPE_CONTACT); - TpIntSet *handles = NULL; + TpIntset *handles = NULL; TpHandle member = 0; TpHandle actor = 0; const char *jid = wocky_muc_jid (wmuc); @@ -2030,7 +2030,7 @@ handle_left (GObject *source, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (tp_base_channel_get_connection (base), TP_HANDLE_TYPE_CONTACT); - TpIntSet *handles = NULL; + TpIntset *handles = NULL; TpHandle member = 0; TpHandle actor = 0; @@ -2140,7 +2140,7 @@ handle_renamed (GObject *source, TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (tp_base_channel_get_connection (base), TP_HANDLE_TYPE_CONTACT); - TpIntSet *old_self = tp_intset_new (); + TpIntset *old_self = tp_intset_new (); const gchar *me = wocky_muc_jid (wmuc); const gchar *me2 = wocky_muc_user (wmuc); TpHandle myself = tp_handle_ensure (contact_repo, me, @@ -2931,7 +2931,7 @@ gabble_muc_channel_add_member (GObject *obj, if (handle == mixin->self_handle) { TpBaseConnection *conn = tp_base_channel_get_connection (base); - TpIntSet *set_remove_members, *set_remote_pending; + TpIntset *set_remove_members, *set_remote_pending; GArray *arr_members; /* are we already a member or in remote pending? */ @@ -3249,7 +3249,7 @@ request_config_form_reply_cb ( * platforms, so fail at compile time if this is no longer the case */ #if TP_NUM_BASE_ROOM_CONFIG_PROPERTIES > 32 -#error GabbleMUCChannel request_config_form_reply_cb needs porting to TpIntSet +#error GabbleMUCChannel request_config_form_reply_cb needs porting to TpIntset #endif props_left = 0; diff --git a/src/muc-factory.c b/src/muc-factory.c index b982707..c208c2d 100644 --- a/src/muc-factory.c +++ b/src/muc-factory.c @@ -1222,7 +1222,7 @@ handle_text_channel_request (GabbleMucFactory *self, TpBaseConnection *conn = TP_BASE_CONNECTION (priv->conn); GabbleMucChannel *text_chan; TpHandleSet *handles; - TpIntSet *continue_handles; + TpIntset *continue_handles; guint i; gboolean ret = TRUE; diff --git a/src/presence-cache.h b/src/presence-cache.h index 8c76551..5502344 100644 --- a/src/presence-cache.h +++ b/src/presence-cache.h @@ -68,7 +68,7 @@ struct _GabbleCapabilityInfo /* array of WockyDataForm or NULL */ GPtrArray *data_forms; - TpIntSet *guys; + TpIntset *guys; guint trust; /* bitfield of GabbleClientType flags */ diff --git a/src/roster.c b/src/roster.c index 96db7c2..d77adb1 100644 --- a/src/roster.c +++ b/src/roster.c @@ -526,7 +526,7 @@ _gabble_roster_item_update (GabbleRoster *roster, GabbleRosterPrivate *priv = roster->priv; GabbleRosterItem *item; const gchar *ask, *name; - TpIntSet *new_groups, *added_to, *removed_from, *removed_from2; + TpIntset *new_groups, *added_to, *removed_from, *removed_from2; TpHandleSet *new_groups_handle_set, *old_groups; TpBaseContactList *base = (TpBaseContactList *) roster; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( @@ -588,7 +588,7 @@ _gabble_roster_item_update (GabbleRoster *roster, if (roster->priv->groups != NULL) { - TpIntSet *created_groups = tp_handle_set_update (roster->priv->groups, + TpIntset *created_groups = tp_handle_set_update (roster->priv->groups, new_groups); /* we don't need to do this work if TpBaseContactList will just be @@ -599,7 +599,7 @@ _gabble_roster_item_update (GabbleRoster *roster, { GPtrArray *strv = g_ptr_array_sized_new (tp_intset_size ( created_groups)); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle group; tp_intset_fast_iter_init (&iter, created_groups); @@ -636,7 +636,7 @@ _gabble_roster_item_update (GabbleRoster *roster, GPtrArray *removed_names = g_ptr_array_sized_new ( tp_intset_size (removed_from)); TpHandleSet *the_contact = tp_handle_set_new (contact_repo); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle group; tp_handle_set_add (the_contact, contact_handle); @@ -1969,7 +1969,7 @@ roster_item_apply_edits (GabbleRoster *roster, { gboolean altered = FALSE; GabbleRosterItem edited_item; - TpIntSet *intset; + TpIntset *intset; GabbleRosterPrivate *priv = roster->priv; TpHandleRepoIface *group_repo = tp_base_connection_get_handles ( (TpBaseConnection *) priv->conn, TP_HANDLE_TYPE_GROUP); @@ -2658,7 +2658,7 @@ gabble_roster_request_subscription_added_cb (GObject *source, (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); SubscribeContext *context = user_data; GError *error = NULL; - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; /* Now that we've added all the contacts, send off all the subscription @@ -2712,7 +2712,7 @@ gabble_roster_request_subscription_async (TpBaseContactList *base, GSimpleAsyncResult *result = gabble_simple_async_countdown_new (self, gabble_roster_request_subscription_added_cb, context, gabble_roster_request_subscription_async, 1); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; /* Before subscribing, add items to the roster @@ -2740,7 +2740,7 @@ gabble_roster_authorize_publication_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GError *error = NULL; TpHandleRepoIface *contact_repo = tp_base_connection_get_handles ( @@ -2793,7 +2793,7 @@ gabble_roster_store_contacts_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GSimpleAsyncResult *result = gabble_simple_async_countdown_new (self, callback, user_data, gabble_roster_store_contacts_async, 1); @@ -2814,7 +2814,7 @@ gabble_roster_remove_contacts_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GSimpleAsyncResult *result = gabble_simple_async_countdown_new (self, callback, user_data, gabble_roster_request_subscription_async, 1); @@ -2839,7 +2839,7 @@ gabble_roster_unsubscribe_async (TpBaseContactList *base, (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); TpHandleSet *changed = tp_handle_set_new (contact_repo); TpHandleSet *removed = tp_handle_set_new (contact_repo); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GError *error = NULL; @@ -2900,7 +2900,7 @@ gabble_roster_unpublish_async (TpBaseContactList *base, (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_CONTACT); TpHandleSet *changed = tp_handle_set_new (contact_repo); TpHandleSet *removed = tp_handle_set_new (contact_repo); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GError *error = NULL; @@ -3041,7 +3041,7 @@ gabble_roster_block_contacts_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GSimpleAsyncResult *result = gabble_simple_async_countdown_new (self, callback, user_data, gabble_roster_request_subscription_async, 1); @@ -3062,7 +3062,7 @@ gabble_roster_unblock_contacts_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; GSimpleAsyncResult *result = gabble_simple_async_countdown_new (self, callback, user_data, gabble_roster_request_subscription_async, 1); @@ -3086,7 +3086,7 @@ gabble_roster_dup_groups (TpBaseContactList *base) if (self->priv->groups != NULL) { - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle group; ret = g_ptr_array_sized_new ( @@ -3122,7 +3122,7 @@ gabble_roster_dup_contact_groups (TpBaseContactList *base, { TpHandleRepoIface *group_repo = tp_base_connection_get_handles ( (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_GROUP); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle group; ret = g_ptr_array_sized_new (tp_handle_set_size (item->groups) + 1); @@ -3315,7 +3315,7 @@ gabble_roster_add_to_group_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; TpHandleRepoIface *group_repo = tp_base_connection_get_handles ( (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_GROUP); @@ -3363,7 +3363,7 @@ gabble_roster_remove_from_group_async (TpBaseContactList *base, gpointer user_data) { GabbleRoster *self = GABBLE_ROSTER (base); - TpIntSetFastIter iter; + TpIntsetFastIter iter; TpHandle contact; TpHandleRepoIface *group_repo = tp_base_connection_get_handles ( (TpBaseConnection *) self->priv->conn, TP_HANDLE_TYPE_GROUP); -- 1.7.10