cpw.nader.asynclogging-3: 159177a4: Reworked the SIMPLE_ASYNC_RESULT_NEW_GOO...

morshed.nader at gmail.com morshed.nader at gmail.com
Sat Jan 7 22:01:53 EST 2012


----------------------------------------------------------------------
Revision: 159177a40d26495d9a8c6b750dddaf66af86463e
Parent:   16b45a6c63e44407a255e4c31df535810007f4bc
Author:   morshed.nader at gmail.com
Date:     01/06/12 18:04:27
Branch:   im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/159177a40d26495d9a8c6b750dddaf66af86463e

Changelog: 

Reworked the SIMPLE_ASYNC_RESULT_NEW_GOOD macro slightly
Added a purple_common_log_write function, currently nothing in it, though

Changes against parent 16b45a6c63e44407a255e4c31df535810007f4bc

  patched  libpurple/commonlog.c
  patched  libpurple/htmllog.c
  patched  libpurple/txtlog.c

-------------- next part --------------
============================================================
--- libpurple/htmllog.c	0bc89e7a100b7205950db27af802779464707b57
+++ libpurple/htmllog.c	cc91227e59a5416773ee3227b8ab09190c0585d9
@@ -30,11 +30,11 @@
 
 
 /* Helpful macros */
-#define SIMPLE_ASYNC_RESULT_NEW_GOOD(obj, cb, data, source, cmd) \
+#define SIMPLE_ASYNC_RESULT_NEW_GOOD(obj, cb, data, source, set_op_cmb, val, ...) \
 	{ \
 		GSimpleAsyncResult *simple; \
 		simple = g_simple_async_result_new(G_OBJECT(obj), cb, data, source); \
-		cmd; \
+		set_op_cmb(simple, val, ##__VA_ARGS__); \
 		g_simple_async_result_complete_in_idle(simple); \
 		g_object_unref(simple); \
 	}
@@ -760,8 +760,9 @@ purple_html_log_read_async_2(GObject *ob
 
 	SIMPLE_ASYNC_RESULT_NEW_GOOD(log, data->cb, data->userdata,
 		purple_html_log_read_async,
-		g_simple_async_result_set_op_res_gpointer(simple, res_data,
-			_read_res_callback_data_free));
+		g_simple_async_result_set_op_res_gpointer,
+		res_data,
+		_read_res_callback_data_free);
 }
 
 static gssize
============================================================
--- libpurple/txtlog.c	170b7a5869985babf3c9ec8e7425458864c24a9b
+++ libpurple/txtlog.c	002edc765caba7e5500f87d4dae2ad237fc34f86
@@ -29,11 +29,11 @@
 
 
 /* Helpful macros */
-#define SIMPLE_ASYNC_RESULT_NEW_GOOD(obj, cb, data, source, cmd) \
+#define SIMPLE_ASYNC_RESULT_NEW_GOOD(obj, cb, data, source, set_op_cmb, val, ...) \
 	{ \
 		GSimpleAsyncResult *simple; \
 		simple = g_simple_async_result_new(G_OBJECT(obj), cb, data, source); \
-		cmd; \
+		set_op_cmb(simple, val, ##__VA_ARGS__); \
 		g_simple_async_result_complete_in_idle(simple); \
 		g_object_unref(simple); \
 	}
@@ -317,8 +317,9 @@ purple_txt_log_read_async_2(GObject *obj
 
 	SIMPLE_ASYNC_RESULT_NEW_GOOD(log, data->cb, data->userdata,
 		purple_txt_log_read_async,
-		g_simple_async_result_set_op_res_gpointer(simple, res_data,
-			_read_res_callback_data_free));
+		g_simple_async_result_set_op_res_gpointer,
+		res_data,
+		_read_res_callback_data_free);
 }
 
 static gssize
============================================================
--- libpurple/commonlog.c	748c7b8ab45b1bac8b342466227efdb37480d701
+++ libpurple/commonlog.c	d6d9392d94afb521124cacb67520f8f0432631fb
@@ -41,11 +41,11 @@
 	g_object_notify(G_OBJECT(obj), name);
 #endif
 
-#define SIMPLE_ASYNC_RESULT_NEW_GOOD(obj, cb, data, source, cmd) \
+#define SIMPLE_ASYNC_RESULT_NEW_GOOD(obj, cb, data, source, set_op_cmb, val, ...) \
 	{ \
 		GSimpleAsyncResult *simple; \
 		simple = g_simple_async_result_new(G_OBJECT(obj), cb, data, source); \
-		cmd; \
+		set_op_cmb(simple, val, ##__VA_ARGS__); \
 		g_simple_async_result_complete_in_idle(simple); \
 		g_object_unref(simple); \
 	}
@@ -611,7 +611,8 @@ purple_common_log_create_async(PurpleLog
 	} else
 		SIMPLE_ASYNC_RESULT_NEW_GOOD(log, cb, userdata, 
 			purple_common_log_create_async,
-			g_simple_async_result_set_op_res_gboolean(simple, TRUE));
+			g_simple_async_result_set_op_res_gboolean,
+			TRUE);
 }
 
 static gboolean
@@ -649,7 +650,8 @@ purple_common_log_create_async_2(gpointe
 
 	SIMPLE_ASYNC_RESULT_NEW_GOOD(data->log, data->cb,
 		data->userdata, purple_common_log_create_async,
-		g_simple_async_result_set_op_res_gboolean(simple, TRUE));
+		g_simple_async_result_set_op_res_gboolean,
+		TRUE);
 
 	return FALSE;
 }
@@ -792,8 +794,9 @@ purple_common_log_read_async_2(GIOChanne
 
 		SIMPLE_ASYNC_RESULT_NEW_GOOD(data->log, data->cb, data->userdata,
 			purple_common_log_read_async,
-			g_simple_async_result_set_op_res_gpointer(simple, res_data,
-				_read_res_callback_data_free));
+			g_simple_async_result_set_op_res_gpointer,
+			res_data,
+			_read_res_callback_data_free);
 
 		return FALSE;
 
@@ -829,6 +832,13 @@ purple_common_log_read_finish(PurpleLog 
 	return g_strdup(res_data->text);
 }
 
+gssize
+purple_common_log_write(PurpleLog *log, const gchar *message,
+	GCancellable *cancellable, GError **error)
+{
+	return 0;
+}
+
 /* XXX: Poorly named */
 static PurpleLog *
 create_log(const gchar *path, PurpleLogChatType chat_type, const gchar *name,
@@ -1097,8 +1107,9 @@ purple_common_log_list_async_4(GObject *
 		/* Everything went fine, notify the user of the logs */
 		SIMPLE_ASYNC_RESULT_NEW_GOOD(enumerator, data->cb, data->userdata,
 			purple_common_log_list_async,
-			g_simple_async_result_set_op_res_gpointer(simple, data->logs,
-				(GDestroyNotify) purple_log_list_free));
+			g_simple_async_result_set_op_res_gpointer,
+			data->logs,
+			(GDestroyNotify) purple_log_list_free);
 
 	list_callback_data_free(data);
 }
@@ -1336,7 +1347,8 @@ purple_common_log_total_size_async_4(GOb
 	} else
 		SIMPLE_ASYNC_RESULT_NEW_GOOD(enumerator, data->cb, data->userdata,
 			purple_common_log_list_async,
-			g_simple_async_result_set_op_res_gssize(simple, data->total));
+			g_simple_async_result_set_op_res_gssize,
+			data->total);
 
 	total_size_callback_data_free(data);
 }


More information about the Commits mailing list