/pidgin/main: 5d9c3ec722d6: Better compatibility with old glib v...

Tomasz Wasilczyk tomkiewicz at cpw.pidgin.im
Tue Oct 23 06:49:39 EDT 2012


Changeset: 5d9c3ec722d6a0c797ad3d727965c25aa075fd18
Author:	 Tomasz Wasilczyk <tomkiewicz at cpw.pidgin.im>
Date:	 2012-10-23 12:47 +0200
Branch:	 default
URL: http://hg.pidgin.im/pidgin/main/rev/5d9c3ec722d6

Description:

Better compatibility with old glib versions

diffstat:

 libpurple/glibcompat.h |  29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)

diffs (51 lines):

diff --git a/libpurple/glibcompat.h b/libpurple/glibcompat.h
--- a/libpurple/glibcompat.h
+++ b/libpurple/glibcompat.h
@@ -25,31 +25,34 @@
  * Also, any public API should not depend on this file.
  */
 
+#if !GLIB_CHECK_VERSION(2, 20, 0)
+
+#define G_OFFSET_FORMAT G_GINT64_FORMAT
+
 #if !GLIB_CHECK_VERSION(2, 28, 0)
 
+static inline gint64 g_get_monotonic_time(void)
+{
+	GTimeVal time_s;
+
+	g_get_current_time(&time_s);
+
+	return ((gint64)time_s.tv_sec << 32) | time_s.tv_usec;
+}
+
 static inline void g_list_free_full(GList *list, GDestroyNotify free_func)
 {
-	GList *it;
-	it = g_list_first(list);
-	while (it)
-	{
-		free_func(it->data);
-		it = g_list_next(it);
-	}
+	g_list_foreach(list, (GFunc)free_func, NULL);
 	g_list_free(list);
 }
 
 static inline void g_slist_free_full(GSList *list, GDestroyNotify free_func)
 {
-	GSList *it = list;
-	while (it)
-	{
-		free_func(it->data);
-		it = g_slist_next(it);
-	}
+	g_slist_foreach(list, (GFunc)free_func, NULL);
 	g_slist_free(list);
 }
 
 #endif /* 2.28.0 */
+#endif /* 2.20.0 */
 
 #endif /* _PIDGINGLIBCOMPAT_H_ */



More information about the Commits mailing list