/soc/2015/jgeboski/facebook: 56c954d1a430: facebook: removed wei...
James Geboski
jgeboski at gmail.com
Mon Aug 24 19:58:01 EDT 2015
Changeset: 56c954d1a4306989a6af207d700ee3d8fe444c69
Author: James Geboski <jgeboski at gmail.com>
Date: 2015-08-24 19:29 -0400
Branch: facebook
URL: https://hg.pidgin.im/soc/2015/jgeboski/facebook/rev/56c954d1a430
Description:
facebook: removed weird usage of g_slist_copy_deep()
diffstat:
libpurple/glibcompat.h | 19 -------------------
libpurple/protocols/facebook/api.c | 13 ++++++++++---
2 files changed, 10 insertions(+), 22 deletions(-)
diffs (67 lines):
diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -61,23 +61,6 @@ static inline gboolean g_close(gint fd,
return FALSE;
}
-#if !GLIB_CHECK_VERSION(2, 34, 0)
-
-static inline GSList * g_slist_copy_deep(GSList *list, GCopyFunc func,
- gpointer data)
-{
- GSList *ret = NULL;
- GSList *l;
-
- if (G_UNLIKELY(func == NULL))
- return g_slist_copy(list);
-
- for (l = list; l != NULL; l = l->next)
- ret = g_slist_prepend(ret, func(l->data, data));
-
- return g_slist_reverse(ret);
-}
-
#if !GLIB_CHECK_VERSION(2, 32, 0)
#include <glib-object.h>
@@ -209,8 +192,6 @@ static inline GError * g_error_new_valis
#endif /* < 2.32.0 */
-#endif /* < 2.34.0 */
-
#endif /* < 2.36.0 */
diff --git a/libpurple/protocols/facebook/api.c b/libpurple/protocols/facebook/api.c
--- a/libpurple/protocols/facebook/api.c
+++ b/libpurple/protocols/facebook/api.c
@@ -2943,6 +2943,8 @@ FbApiThread *
fb_api_thread_dup(const FbApiThread *thrd, gboolean deep)
{
FbApiThread *ret;
+ FbApiUser *user;
+ GSList *l;
if (thrd == NULL) {
return g_new0(FbApiThread, 1);
@@ -2951,10 +2953,15 @@ fb_api_thread_dup(const FbApiThread *thr
ret = g_memdup(thrd, sizeof *thrd);
if (deep) {
+ ret->users = NULL;
+
+ for (l = thrd->users; l != NULL; l = l->next) {
+ user = fb_api_user_dup(l->data, TRUE);
+ ret->users = g_slist_prepend(ret->users, user);
+ }
+
ret->topic = g_strdup(thrd->topic);
- ret->users = g_slist_copy_deep(thrd->users,
- (GCopyFunc) fb_api_user_dup,
- GINT_TO_POINTER(deep));
+ ret->users = g_slist_reverse(ret->users);
}
return ret;
More information about the Commits
mailing list