[telepathy-gabble/master] Add gabble_g_ptr_array_copy
Will Thompson
will.thompson at collabora.co.uk
Wed Aug 19 06:13:07 PDT 2009
---
src/media-channel.c | 9 +--------
src/util.c | 12 ++++++++++++
src/util.h | 2 ++
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/src/media-channel.c b/src/media-channel.c
index 07ee388..7c4cc0d 100644
--- a/src/media-channel.c
+++ b/src/media-channel.c
@@ -2254,14 +2254,7 @@ gabble_media_channel_remove_member (GObject *obj,
static GPtrArray *
copy_stream_list (GabbleMediaChannel *channel)
{
- GabbleMediaChannelPrivate *priv = channel->priv;
- guint i;
- GPtrArray *ret = g_ptr_array_sized_new (priv->streams->len);
-
- for (i = 0; i < priv->streams->len; i++)
- g_ptr_array_add (ret, g_ptr_array_index (priv->streams, i));
-
- return ret;
+ return gabble_g_ptr_array_copy (channel->priv->streams);
}
static void
diff --git a/src/util.c b/src/util.c
index 9db61de..62e80fd 100644
--- a/src/util.c
+++ b/src/util.c
@@ -1113,3 +1113,15 @@ next_attribute:
return result;
}
+
+GPtrArray *
+gabble_g_ptr_array_copy (GPtrArray *source)
+{
+ GPtrArray *ret = g_ptr_array_sized_new (source->len);
+ guint i;
+
+ for (i = 0; i < source->len; i++)
+ g_ptr_array_add (ret, g_ptr_array_index (source, i));
+
+ return ret;
+}
diff --git a/src/util.h b/src/util.h
index e2695b1..0bdde9b 100644
--- a/src/util.h
+++ b/src/util.h
@@ -93,4 +93,6 @@ const gchar * lm_message_node_get_attribute_with_namespace (LmMessageNode *node,
const gchar *attribute,
const gchar *ns);
+GPtrArray *gabble_g_ptr_array_copy (GPtrArray *source);
+
#endif /* __GABBLE_UTIL_H__ */
--
1.5.6.5
More information about the telepathy-commits
mailing list