cpw.nader.asynclogging-3: 6263ac6e: Cut down long lines in log.c

morshed.nader at gmail.com morshed.nader at gmail.com
Thu May 12 03:41:37 EDT 2011


----------------------------------------------------------------------
Revision: 6263ac6e3e58599314613a343aa1fef0f0ed8396
Parent:   a359934b2f449cf55373aa4cd013b36eefd12e88
Author:   morshed.nader at gmail.com
Date:     05/12/11 02:43:51
Branch:   im.pidgin.cpw.nader.asynclogging-3
URL: http://d.pidgin.im/viewmtn/revision/info/6263ac6e3e58599314613a343aa1fef0f0ed8396

Changelog: 

Cut down long lines in log.c
Removed uses of '//', replacing them with '/* XXX: ... */'

Changes against parent a359934b2f449cf55373aa4cd013b36eefd12e88

  patched  libpurple/log.c

-------------- next part --------------
============================================================
--- libpurple/log.c	57aabc8fcc5479f546ae74f30499f0aef77c221d
+++ libpurple/log.c	72e3ee44aa596f2228d13ef72ed05beb19b206d9
@@ -52,7 +52,8 @@ static void purple_log_get_property(GObj
 
 G_DEFINE_TYPE (PurpleLog, purple_log, G_TYPE_OBJECT)
 static void purple_log_get_property(GObject *, guint, GValue *, GParamSpec *);
-static void purple_log_set_property(GObject *, guint, const GValue *, GParamSpec *);
+static void purple_log_set_property(GObject *, guint, const GValue *,
+	GParamSpec *);
 static void purple_log_finalize(GObject *);
 
 enum {
@@ -146,41 +147,63 @@ static void write_thread(GSimpleAsyncRes
 
 static void write_update_size_cache(PurpleLog *, gssize);
 static void write_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_write_async(PurpleLog *, PurpleMessageFlags, const gchar *, time_t, const gchar *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static gssize purple_log_real_write_finish(PurpleLog *, GAsyncResult *, GError **);
+static void purple_log_real_write_async(PurpleLog *, PurpleMessageFlags,
+	const gchar *, time_t, const gchar *, gint, GCancellable *,
+	GAsyncReadyCallback, gpointer);
+static gssize purple_log_real_write_finish(PurpleLog *, GAsyncResult *,
+	GError **);
 
 static void log_read_res_free(gpointer);
 static void read_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_read_async(PurpleLog *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static gchar *purple_log_real_read_finish(PurpleLog *, GAsyncResult *, PurpleLogReadFlags *, GError **);
+static void purple_log_real_read_async(PurpleLog *, gint, GCancellable *,
+	GAsyncReadyCallback, gpointer);
+static gchar *purple_log_real_read_finish(PurpleLog *, GAsyncResult *,
+	PurpleLogReadFlags *, GError **);
 
 static void size_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_size_async(PurpleLog *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static gssize purple_log_real_size_finish(PurpleLog *, GAsyncResult *, GError **);
+static void purple_log_real_size_async(PurpleLog *, gint, GCancellable *,
+	GAsyncReadyCallback, gpointer);
+static gssize purple_log_real_size_finish(PurpleLog *, GAsyncResult *,
+	GError **);
 
 static void get_logs_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_get_logs_async(PurpleLog *, PurpleLogChatType, const gchar *, PurpleAccount *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static GList *purple_log_real_get_logs_finish(PurpleLog *, GAsyncResult *, GError **);
+static void purple_log_real_get_logs_async(PurpleLog *, PurpleLogChatType,
+	const gchar *, PurpleAccount *, gint, GCancellable *, GAsyncReadyCallback,
+	gpointer);
+static GList *purple_log_real_get_logs_finish(PurpleLog *, GAsyncResult *,
+	GError **);
 
 static void list_syslog_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_list_syslog_async(PurpleLog *, PurpleAccount *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static GList *purple_log_real_list_syslog_finish(PurpleLog *, GAsyncResult *, GError **);
+static void purple_log_real_list_syslog_async(PurpleLog *, PurpleAccount *,
+	gint, GCancellable *, GAsyncReadyCallback, gpointer);
+static GList *purple_log_real_list_syslog_finish(PurpleLog *, GAsyncResult *,
+	GError **);
 
 static void total_size_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_total_size_async(PurpleLog *, PurpleLogChatType, const gchar *, PurpleAccount *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static gssize purple_log_real_total_size_finish(PurpleLog *, GAsyncResult *, GError **);
+static void purple_log_real_total_size_async(PurpleLog *, PurpleLogChatType,
+	const gchar *, PurpleAccount *, gint, GCancellable *, GAsyncReadyCallback,
+	gpointer);
+static gssize purple_log_real_total_size_finish(PurpleLog *, GAsyncResult *,
+	GError **);
 
-static void get_log_sets_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_get_log_sets_async(PurpleLog *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static GHashTable *purple_log_real_get_log_sets_finish(PurpleLog *, GAsyncResult *, GError **);
+static void get_log_sets_thread(GSimpleAsyncResult *, GObject *,
+	GCancellable *);
+static void purple_log_real_get_log_sets_async(PurpleLog *, gint,
+	GCancellable *, GAsyncReadyCallback, gpointer);
+static GHashTable *purple_log_real_get_log_sets_finish(PurpleLog *,
+	GAsyncResult *, GError **);
 
 static GHashTable *log_get_log_sets_common(GCancellable *, GError **);
-static void log_get_log_sets_common_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void log_get_log_sets_common_async(gint, GCancellable *, GAsyncReadyCallback, gpointer);
+static void log_get_log_sets_common_thread(GSimpleAsyncResult *, GObject *,
+	GCancellable *);
+static void log_get_log_sets_common_async(gint, GCancellable *,
+	GAsyncReadyCallback, gpointer);
 
 static void remove_thread(GSimpleAsyncResult *, GObject *, GCancellable *);
-static void purple_log_real_remove_async(PurpleLog *, gint, GCancellable *, GAsyncReadyCallback, gpointer);
-static gboolean purple_log_real_remove_finish(PurpleLog *, GAsyncResult *, GError **);
+static void purple_log_real_remove_async(PurpleLog *, gint, GCancellable *,
+	GAsyncReadyCallback, gpointer);
+static gboolean purple_log_real_remove_finish(PurpleLog *, GAsyncResult *,
+	GError **);
 
 static void log_list_cb(GObject *, GAsyncResult *, gpointer);
 static void log_system_list_cb(GObject *, GAsyncResult *, gpointer);
@@ -200,6 +223,7 @@ static GHashTable *logsize_users_decayed
 static GHashTable *logsize_users_decayed = NULL;
 
 
+/* XXX: Replace this with glib-mkenums when merged with gobjectification */
 GType
 purple_log_chat_type_get_type(void)
 {
@@ -213,7 +237,8 @@ purple_log_chat_type_get_type(void)
 			{ 0, NULL, NULL }
 		};
 
-		type = g_enum_register_static(g_intern_static_string("PurpleLogChatType"), values);
+		type = g_enum_register_static(g_intern_static_string("PurpleLogChatType"),
+			values);
 	}
 
 	return type;
@@ -233,7 +258,8 @@ typedef struct tm PurpleStructTM;
 #if GLIB_CHECK_VERSION(2, 26, 0)
 
 typedef struct tm PurpleStructTM;
-G_DEFINE_BOXED_TYPE (PurpleStructTM, purple_struct_tm, purple_struct_tm_copy, g_free);
+G_DEFINE_BOXED_TYPE (PurpleStructTM, purple_struct_tm, purple_struct_tm_copy,
+	g_free);
 
 #else
 
@@ -295,19 +321,19 @@ purple_log_class_init(PurpleLogClass *cl
 			G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
 	properties[PROP_LOG_ACCOUNT] =
-		//Ideally should be g_param_spec_object
+		/* XXX: Ideally should be g_param_spec_object */
 		g_param_spec_pointer("account",
 			"Account",
 			"The account the conversation is occurring on",
-//			PURPLE_TYPE_ACCOUNT,
+			/* XXX: PURPLE_TYPE_ACCOUNT,*/
 			G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
 	properties[PROP_LOG_CONVERSATION] =
-		//Ideally should be g_param_spec_object
+		/* XXX: Ideally should be g_param_spec_object */
 		g_param_spec_pointer("conversation",
 			"Conversation",
 			"The conversation being logged",
-//			PURPLE_TYPE_CONVERSATION,
+			/* XXX: PURPLE_TYPE_CONVERSATION, */
 			G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
 
 	properties[PROP_LOG_TIME] =
@@ -363,7 +389,7 @@ purple_log_init(PurpleLog *log)
 	priv->account = NULL;
 	priv->time = 0;
 	priv->conversation = NULL;
-	//These needed?
+	/* XXX: This needed? */
 	priv->tm = NULL;
 }
 
@@ -375,7 +401,7 @@ purple_log_set_chat_type(PurpleLog *log,
 	PURPLE_LOG_GET_PRIVATE(log)->chat_type = chat_type;
 
 	g_object_notify(G_OBJECT(log), "chat-type");
-	// g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CHAT_TYPE]);
+	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CHAT_TYPE]); */
 }
 
 static void
@@ -387,7 +413,7 @@ purple_log_set_name(PurpleLog *log, cons
 	PURPLE_LOG_GET_PRIVATE(log)->name = g_strdup(name);
 
 	g_object_notify(G_OBJECT(log), "name");
-	// g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_NAME]);
+	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_NAME]); */
 }
 
 static void
@@ -395,24 +421,24 @@ purple_log_set_account(PurpleLog *log, P
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
 	/* Account can be NULL when we create our dummy logs */
-	// g_return_if_fail(account == NULL || PURPLE_IS_ACCOUNT(account));
+	/* XXX: g_return_if_fail(account == NULL || PURPLE_IS_ACCOUNT(account)); */
 
-	PURPLE_LOG_GET_PRIVATE(log)->account = account; // g_object_ref
+	PURPLE_LOG_GET_PRIVATE(log)->account = account; /* XXX: g_object_ref */
 
 	g_object_notify(G_OBJECT(log), "account");
-	// g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_ACCOUNT]);
+	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_ACCOUNT]); */
 }
 
 static void
 purple_log_set_conversation(PurpleLog *log, PurpleConversation *conversation)
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
-	// g_return_if_fail(conversation == NULL || PURPLE_IS_CONVERSATION(conversation));
+	/* XXX: g_return_if_fail(conversation == NULL || PURPLE_IS_CONVERSATION(conversation)); */
 
-	PURPLE_LOG_GET_PRIVATE(log)->conversation = conversation; // g_object_ref
+	PURPLE_LOG_GET_PRIVATE(log)->conversation = conversation; /* XXX: g_object_ref */
 
 	g_object_notify(G_OBJECT(log), "conversation");
-	// g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CONVERSATION]);
+	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_CONVERSATION]); */
 }
 
 static void
@@ -423,7 +449,7 @@ purple_log_set_time(PurpleLog *log, time
 	PURPLE_LOG_GET_PRIVATE(log)->time = log_time;
 
 	g_object_notify(G_OBJECT(log), "time");
-	// g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TIME]);
+	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TIME]); */
 }
 
 static void
@@ -446,7 +472,8 @@ purple_log_set_tm(PurpleLog *log, struct
 #ifdef HAVE_STRUCT_TM_TM_ZONE
 		/* XXX: This is so wrong... */
 		if (priv->tm->tm_zone != NULL) {
-			gchar *tmp = g_locale_from_utf8(priv->tm->tm_zone, -1, NULL, NULL, NULL);
+			gchar *tmp = g_locale_from_utf8(priv->tm->tm_zone, -1,
+							NULL, NULL, NULL);
 
 			if (tmp != NULL)
 				priv->tm->tm_zone = tmp;
@@ -458,7 +485,7 @@ purple_log_set_tm(PurpleLog *log, struct
 	}
 
 	g_object_notify(G_OBJECT(log), "tm");
-	// g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TM]);
+	/* XXX: g_object_notify_by_pspec(G_OBJECT(log), properties[PROP_LOG_TM]); */
 }
 
 PurpleLogChatType
@@ -510,7 +537,8 @@ static void
 }
 
 static void
-purple_log_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+purple_log_set_property(GObject *object, guint prop_id, const GValue *value,
+	GParamSpec *pspec)
 {
 	PurpleLog *log = PURPLE_LOG(object);
 
@@ -522,11 +550,11 @@ purple_log_set_property(GObject *object,
 		purple_log_set_name(log, g_value_get_string(value));
 		break;
 	case PROP_LOG_ACCOUNT:
-		//g_value_get_object
+		/* XXX: g_value_get_object */
 		purple_log_set_account(log, g_value_get_pointer(value));
 		break;
 	case PROP_LOG_CONVERSATION:
-		//g_value_get_object
+		/* XXX: g_value_get_object */
 		purple_log_set_conversation(log, g_value_get_pointer(value));
 		break;
 	case PROP_LOG_TIME:
@@ -542,7 +570,8 @@ static void
 }
 
 static void
-purple_log_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+purple_log_get_property(GObject *object, guint prop_id, GValue *value,
+	GParamSpec *pspec)
 {
 	PurpleLog *log = PURPLE_LOG(object);
 
@@ -554,14 +583,14 @@ purple_log_get_property(GObject *object,
 		g_value_set_string(value, purple_log_get_name(log));
 		break;
 	case PROP_LOG_ACCOUNT:
-		//g_value_set_object
+		/* XXX: g_value_set_object */
 		g_value_set_pointer(value, purple_log_get_account(log));
 		break;
 	case PROP_LOG_TIME:
 		g_value_set_long(value, purple_log_get_time(log));
 		break;
 	case PROP_LOG_CONVERSATION:
-		//g_value_set_object
+		/* XXX: g_value_set_object */
 		g_value_set_pointer(value, purple_log_get_conversation(log));
 		break;
 	case PROP_LOG_TM:
@@ -578,8 +607,9 @@ thread_callback_data_free(gpointer userd
 {
 	_thread_callback_data *callback_data = userdata;
 
-	// if (callback_data->account != NULL)
-		// g_object_unref(callback_data->account);
+	/* XXX;
+	if (callback_data->account != NULL)
+		g_object_unref(callback_data->account); */
 
 	g_free(callback_data->name);
 	g_free(callback_data->ext);
@@ -603,9 +633,10 @@ purple_log_new(GType log_type, PurpleLog
 {
 	PurpleLog *log;
 
-	g_return_val_if_fail(log_type == G_TYPE_INVALID || g_type_is_a(log_type, PURPLE_TYPE_LOG), NULL);
+	g_return_val_if_fail(log_type == G_TYPE_INVALID || g_type_is_a(log_type, PURPLE_TYPE_LOG),
+		NULL);
 	g_return_val_if_fail(name != NULL, NULL);
-	g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	if (log_type == G_TYPE_INVALID)
 		log_type = current_logger;
@@ -637,7 +668,8 @@ write_update_size_cache(PurpleLog *log, 
 	lu = g_new(_purple_logsize_user, 1);
 	total = 0;
 
-	lu->name = g_strdup(purple_normalize(purple_log_get_account(log), purple_log_get_name(log)));
+	lu->name = g_strdup(purple_normalize(purple_log_get_account(log),
+		purple_log_get_name(log)));
 	lu->account = purple_log_get_account(log);
 
 	G_LOCK(logsize_users);
@@ -647,7 +679,7 @@ write_update_size_cache(PurpleLog *log, 
 		total = GPOINTER_TO_INT(ptrsize);
 		total += size;
 		g_hash_table_replace(logsize_users, lu, GINT_TO_POINTER(total));
-		// purple_debug_info("log", "HASH(purple_log_write): total size %i\n", total);
+		/* XXX: purple_debug_info("log", "HASH(purple_log_write): total size %i\n", total); */
 
 		/* The hash table takes ownership of lu, so create a new one
 		 * for the logsize_users_decayed check below. */
@@ -658,7 +690,8 @@ write_update_size_cache(PurpleLog *log, 
 	G_UNLOCK(logsize_users);
 
 	G_LOCK(logsize_users_decayed);
-	if (g_hash_table_lookup_extended(logsize_users_decayed, lu, NULL, &ptrsize)) {
+	if (g_hash_table_lookup_extended(logsize_users_decayed, lu, NULL, &ptrsize))
+	{
 		total = GPOINTER_TO_INT(ptrsize);
 		total += size;
 		g_hash_table_replace(logsize_users_decayed, lu, GINT_TO_POINTER(total));
@@ -670,7 +703,9 @@ gssize
 }
 
 gssize
-purple_log_write(PurpleLog *log, PurpleMessageFlags type, const gchar *from, time_t time, const gchar *message, GCancellable *cancellable, GError **error)
+purple_log_write(PurpleLog *log, PurpleMessageFlags type, const gchar *from,
+	time_t time, const gchar *message, GCancellable *cancellable,
+	GError **error)
 {
 	PurpleLogClass *class;
 	gssize size;
@@ -697,7 +732,8 @@ static void
 }
 
 static void
-write_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+write_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	_thread_write_callback_data *callback_data =
 		g_simple_async_result_get_op_res_gpointer(simple);
@@ -721,7 +757,9 @@ static void
 }
 
 static void
-purple_log_real_write_async(PurpleLog *log, PurpleMessageFlags flags, const gchar *from, time_t time, const gchar *message, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_write_async(PurpleLog *log, PurpleMessageFlags flags,
+	const gchar *from, time_t time, const gchar *message, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	_thread_write_callback_data *callback_data;
 	GSimpleAsyncResult *simple;
@@ -735,15 +773,17 @@ purple_log_real_write_async(PurpleLog *l
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_write_async);
 
-	g_simple_async_result_set_op_res_gpointer(simple, callback_data, thread_write_callback_data_free);
-	g_simple_async_result_run_in_thread(simple, write_thread, io_priority, cancellable);
+	g_simple_async_result_set_op_res_gpointer(simple, callback_data,
+		thread_write_callback_data_free);
+	g_simple_async_result_run_in_thread(simple, write_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
 void
-purple_log_write_async(PurpleLog *log, PurpleMessageFlags type, const gchar *from,
-	time_t time, const gchar *message, gint io_priority, GCancellable *cancellable,
-	GAsyncReadyCallback cb, gpointer userdata)
+purple_log_write_async(PurpleLog *log, PurpleMessageFlags type,
+	const gchar *from, time_t time, const gchar *message, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	g_return_if_fail(message != NULL);
 	g_return_if_fail(from != NULL);
@@ -777,7 +817,8 @@ gchar *
 }
 
 gchar *
-purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags, GCancellable *cancellable, GError **error)
+purple_log_read(PurpleLog *log, PurpleLogReadFlags *flags,
+	GCancellable *cancellable, GError **error)
 {
 	PurpleLogClass *class;
 
@@ -807,7 +848,8 @@ static void
 }
 
 static void
-read_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+read_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	PurpleLog *log = PURPLE_LOG(object);
 	PurpleLogClass *class = PURPLE_LOG_GET_CLASS(log);
@@ -816,7 +858,9 @@ read_thread(GSimpleAsyncResult *simple, 
 	gchar *text;
 
 	if (class->read_fn == NULL) {
-		g_simple_async_result_set_error(simple, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+		g_simple_async_result_set_error(simple,
+			G_IO_ERROR,
+			G_IO_ERROR_NOT_SUPPORTED,
 			_("Operation not supported"));
 
 		return;
@@ -833,26 +877,30 @@ read_thread(GSimpleAsyncResult *simple, 
 		res_data->flags = flags;
 		res_data->text = text;
 
-		g_simple_async_result_set_op_res_gpointer(simple, res_data, log_read_res_free);
+		g_simple_async_result_set_op_res_gpointer(simple, res_data,
+			log_read_res_free);
 	}
 
 	g_clear_error(&error);
 }
 
 static void
-purple_log_real_read_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_read_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	GSimpleAsyncResult *simple;
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_read_async);
 
-	g_simple_async_result_run_in_thread(simple, read_thread, io_priority, cancellable);
+	g_simple_async_result_run_in_thread(simple, read_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
 void
-purple_log_read_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_read_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
 
@@ -861,7 +909,8 @@ static gchar *
 }
 
 static gchar *
-purple_log_real_read_finish(PurpleLog *log, GAsyncResult *res, PurpleLogReadFlags *flags, GError **error)
+purple_log_real_read_finish(PurpleLog *log, GAsyncResult *res,
+	PurpleLogReadFlags *flags, GError **error)
 {
 	_purple_log_read_res_callback_data *res_data;
 	GSimpleAsyncResult *simple;
@@ -876,7 +925,8 @@ gchar *
 }
 
 gchar *
-purple_log_read_finish(PurpleLog *log, GAsyncResult *res, PurpleLogReadFlags *flags, GError **error)
+purple_log_read_finish(PurpleLog *log, GAsyncResult *res,
+	PurpleLogReadFlags *flags, GError **error)
 {
 	g_return_val_if_fail(PURPLE_IS_LOG(log), NULL);
 	g_return_val_if_fail(G_IS_ASYNC_RESULT(res), NULL);
@@ -913,7 +963,8 @@ static void
 }
 
 static void
-size_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+size_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	PurpleLog *log = PURPLE_LOG(object);
 	PurpleLogClass *class = PURPLE_LOG_GET_CLASS(log);
@@ -921,7 +972,9 @@ size_thread(GSimpleAsyncResult *simple, 
 	gssize size;
 
 	if (class->size_fn == NULL) {
-		g_simple_async_result_set_error(simple, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+		g_simple_async_result_set_error(simple,
+			G_IO_ERROR,
+			G_IO_ERROR_NOT_SUPPORTED,
 			_("Operation not supported"));
 
 		return;
@@ -938,23 +991,27 @@ static void
 }
 
 static void
-purple_log_real_size_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_size_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	GSimpleAsyncResult *simple;
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_size_async);
 
-	g_simple_async_result_run_in_thread(simple, size_thread, io_priority, cancellable);
+	g_simple_async_result_run_in_thread(simple, size_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
 void
-purple_log_get_size_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_get_size_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
 
-	PURPLE_LOG_GET_CLASS(log)->size_async(log, io_priority, cancellable, cb, userdata);
+	PURPLE_LOG_GET_CLASS(log)->size_async(log, io_priority, cancellable, cb,
+		userdata);
 }
 
 static gssize
@@ -980,13 +1037,15 @@ GList *
 }
 
 GList *
-purple_log_get_logs(PurpleLog *log, PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_log_get_logs(PurpleLog *log, PurpleLogChatType chat_type,
+	const gchar *name, PurpleAccount *account, GCancellable *cancellable,
+	GError **error)
 {
 	PurpleLogClass *class;
 
 	g_return_val_if_fail(PURPLE_IS_LOG(log), NULL);
 	g_return_val_if_fail(name != NULL, NULL);
-	g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	class = PURPLE_LOG_GET_CLASS(log);
 
@@ -1003,7 +1062,8 @@ static void
 }
 
 static void
-get_logs_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+get_logs_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	_thread_callback_data *callback_data =
 		g_simple_async_result_get_op_res_gpointer(simple);
@@ -1014,7 +1074,8 @@ get_logs_thread(GSimpleAsyncResult *simp
 	GList *logs;
 	gchar *name = callback_data->name;
 
-	logs = purple_log_get_logs(log, chat_type, name, account, cancellable, &error);
+	logs = purple_log_get_logs(log, chat_type, name, account, cancellable,
+		&error);
 
 	if (logs == NULL && error != NULL)
 		g_simple_async_result_set_from_error(simple, error);
@@ -1026,7 +1087,9 @@ static void
 }
 
 static void
-purple_log_real_get_logs_async(PurpleLog *log, PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_get_logs_async(PurpleLog *log, PurpleLogChatType chat_type,
+	const gchar *name, PurpleAccount *account, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	_thread_callback_data *callback_data;
 	GSimpleAsyncResult *simple;
@@ -1034,28 +1097,34 @@ purple_log_real_get_logs_async(PurpleLog
 	callback_data = g_new0(_thread_callback_data, 1);
 	callback_data->chat_type = chat_type;
 	callback_data->name = g_strdup(name);
-	callback_data->account = account; // g_object_ref
+	callback_data->account = account; /* XXX: g_object_ref */
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_get_logs_async);
 
-	g_simple_async_result_set_op_res_gpointer(simple, callback_data, thread_callback_data_free);
-	g_simple_async_result_run_in_thread(simple, get_logs_thread, io_priority, cancellable);
+	g_simple_async_result_set_op_res_gpointer(simple, callback_data,
+		thread_callback_data_free);
+	g_simple_async_result_run_in_thread(simple, get_logs_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
 void
-purple_log_get_logs_async(PurpleLog *log, PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_get_logs_async(PurpleLog *log, PurpleLogChatType chat_type,
+	const gchar *name, PurpleAccount *account, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
 	g_return_if_fail(name != NULL);
-	g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_if_fail(account != NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
-	PURPLE_LOG_GET_CLASS(log)->list_async(log, chat_type, name, account, io_priority, cancellable, cb, userdata);
+	PURPLE_LOG_GET_CLASS(log)->list_async(log, chat_type, name, account,
+		io_priority, cancellable, cb, userdata);
 }
 
 static GList *
-purple_log_real_get_logs_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_real_get_logs_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	return purple_log_list_copy(g_simple_async_result_get_op_res_gpointer(G_SIMPLE_ASYNC_RESULT(res)));
 }
@@ -1077,14 +1146,15 @@ GList *
 }
 
 GList *
-purple_logs_get_logs(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_logs_get_logs(PurpleLogChatType chat_type, const gchar *name,
+	PurpleAccount *account, GCancellable *cancellable, GError **error)
 {
 	GArray *array;
 	GList *logs = NULL;
 	guint i;
 
 	g_return_val_if_fail(name != NULL, NULL);
-	g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	array = purple_log_logger_get_all();
 
@@ -1095,7 +1165,8 @@ purple_logs_get_logs(PurpleLogChatType c
 		GType log_type = g_array_index(array, GType, i);
 
 		log = g_object_new(log_type, NULL);
-		list = purple_log_get_logs(log, chat_type, name, account, cancellable, &err);
+		list = purple_log_get_logs(log, chat_type, name, account, cancellable,
+			&err);
 
 		if (list == NULL && err != NULL) {
 			g_propagate_error(error, err);
@@ -1113,14 +1184,16 @@ void
 }
 
 void
-purple_logs_get_logs_async(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_logs_get_logs_async(PurpleLogChatType chat_type, const gchar *name,
+	PurpleAccount *account, gint io_priority, GCancellable *cancellable,
+	GAsyncReadyCallback cb, gpointer userdata)
 {
 	_get_logs_callback_data *callback_data;
 	GArray *array;
 	guint i;
 
 	g_return_if_fail(name != NULL);
-	g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_if_fail(account != NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	array = purple_log_logger_get_all();
 
@@ -1135,7 +1208,8 @@ purple_logs_get_logs_async(PurpleLogChat
 		GType log_type = g_array_index(array, GType, i);
 
 		log = g_object_new(log_type, NULL);
-		purple_log_get_logs_async(log, chat_type, name, account, io_priority, cancellable, log_list_cb, callback_data);
+		purple_log_get_logs_async(log, chat_type, name, account, io_priority,
+			cancellable, log_list_cb, callback_data);
 		g_object_unref(log);
 	}
 }
@@ -1156,12 +1230,13 @@ GList *
 }
 
 GList *
-purple_log_get_system_logs(PurpleLog *log, PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_log_get_system_logs(PurpleLog *log, PurpleAccount *account,
+	GCancellable *cancellable, GError **error)
 {
 	PurpleLogClass *class;
 
 	g_return_val_if_fail(PURPLE_IS_LOG(log), NULL);
-	g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	class = PURPLE_LOG_GET_CLASS(log);
 
@@ -1178,13 +1253,14 @@ GList *
 }
 
 GList *
-purple_logs_get_system_logs(PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_logs_get_system_logs(PurpleAccount *account, GCancellable *cancellable,
+	GError **error)
 {
 	GArray *array;
 	GList *logs = NULL;
 	guint i;
 
-	g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	array = purple_log_logger_get_all();
 
@@ -1211,7 +1287,8 @@ static void
 }
 
 static void
-list_syslog_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+list_syslog_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	_thread_callback_data *callback_data =
 		g_simple_async_result_get_op_res_gpointer(simple);
@@ -1219,7 +1296,8 @@ list_syslog_thread(GSimpleAsyncResult *s
 	GError *error = NULL;
 	GList *list;
 
-	list = purple_log_get_system_logs(PURPLE_LOG(object), account, cancellable, &error);
+	list = purple_log_get_system_logs(PURPLE_LOG(object), account, cancellable,
+		&error);
 
 	if (list == NULL && error != NULL)
 		g_simple_async_result_set_from_error(simple, error);
@@ -1231,39 +1309,47 @@ static void
 }
 
 static void
-purple_log_real_list_syslog_async(PurpleLog *log, PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_list_syslog_async(PurpleLog *log, PurpleAccount *account,
+	gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb,
+	gpointer userdata)
 {
 	_thread_callback_data *callback_data;
 	GSimpleAsyncResult *simple;
 
 	callback_data = g_new0(_thread_callback_data, 1);
-	callback_data->account = account; // g_object_ref
+	callback_data->account = account; /* XXX: g_object_ref */
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_list_syslog_async);
 
-	g_simple_async_result_set_op_res_gpointer(simple, callback_data, thread_callback_data_free);
-	g_simple_async_result_run_in_thread(simple, list_syslog_thread, io_priority, cancellable);
+	g_simple_async_result_set_op_res_gpointer(simple, callback_data,
+		thread_callback_data_free);
+	g_simple_async_result_run_in_thread(simple, list_syslog_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
 void
-purple_log_get_system_logs_async(PurpleLog *log, PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_get_system_logs_async(PurpleLog *log, PurpleAccount *account,
+	gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb,
+	gpointer userdata)
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
-	g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_if_fail(account != NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
-	PURPLE_LOG_GET_CLASS(log)->list_syslog_async(log, account, io_priority, cancellable, cb, userdata);
+	PURPLE_LOG_GET_CLASS(log)->list_syslog_async(log, account, io_priority,
+		cancellable, cb, userdata);
 }
 
 void
-purple_logs_get_system_logs_async(PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_logs_get_system_logs_async(PurpleAccount *account, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	_get_logs_callback_data *callback_data;
 	GArray *array;
 	guint i;
 
-	g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_if_fail(account != NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	array = purple_log_logger_get_all();
 
@@ -1278,20 +1364,23 @@ purple_logs_get_system_logs_async(Purple
 		GType log_type = g_array_index(array, GType, i);
 
 		log = g_object_new(log_type, NULL);
-		purple_log_get_system_logs_async(log, account, io_priority, cancellable, log_system_list_cb, callback_data);
+		purple_log_get_system_logs_async(log, account, io_priority, cancellable,
+			log_system_list_cb, callback_data);
 
 		g_object_unref(log);
 	}
 }
 
 static GList *
-purple_log_real_list_syslog_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_real_list_syslog_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	return purple_log_list_copy(g_simple_async_result_get_op_res_gpointer(G_SIMPLE_ASYNC_RESULT(res)));
 }
 
 GList *
-purple_log_get_system_logs_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_get_system_logs_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	g_return_val_if_fail(PURPLE_IS_LOG(log), NULL);
 	g_return_val_if_fail(G_IS_ASYNC_RESULT(res), NULL);
@@ -1330,7 +1419,8 @@ _purple_logsize_user_equal(_purple_logsi
 static guint
 _purple_logsize_user_equal(_purple_logsize_user *lu1, _purple_logsize_user *lu2)
 {
-	return lu1->account == lu2->account && purple_strequal(lu1->name, lu2->name);
+	return lu1->account == lu2->account &&
+		purple_strequal(lu1->name, lu2->name);
 }
 
 static void
@@ -1341,20 +1431,24 @@ gssize
 }
 
 gssize
-purple_log_get_total_size(PurpleLog *log, PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_log_get_total_size(PurpleLog *log, PurpleLogChatType chat_type,
+	const gchar *name, PurpleAccount *account, GCancellable *cancellable,
+	GError **error)
 {
 	PurpleLogClass *class;
 
 	g_return_val_if_fail(PURPLE_IS_LOG(log), -1);
 	g_return_val_if_fail(name != NULL, -1);
-	g_return_val_if_fail(account != NULL, -1); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, -1); /* XXX: PURPLE_IS_ACCOUNT(account) */
 	
 	class = PURPLE_LOG_GET_CLASS(log);
 
 	if (class->total_size_fn){
-		return class->total_size_fn(log, chat_type, name, account, cancellable, error);
+		return class->total_size_fn(log, chat_type, name, account, cancellable,
+			error);
 	} else {
-		GList *logs = purple_log_get_logs(log, chat_type, name, account, cancellable, error);
+		GList *logs = purple_log_get_logs(log, chat_type, name, account,
+			cancellable, error);
 		gssize size, total = 0;
 
 		if (logs == NULL)
@@ -1379,11 +1473,12 @@ static void
 }
 
 static void
-total_size_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+total_size_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	_thread_callback_data *callback_data =
 		g_simple_async_result_get_op_res_gpointer(simple);
-	PurpleAccount *account = callback_data->account; // g_object_unref
+	PurpleAccount *account = callback_data->account; /* XXX: g_object_unref */
 	PurpleLog *log = PURPLE_LOG(object);
 	PurpleLogClass *class = PURPLE_LOG_GET_CLASS(log);
 	PurpleLogChatType chat_type = callback_data->chat_type;
@@ -1392,7 +1487,8 @@ total_size_thread(GSimpleAsyncResult *si
 	gssize size;
 
 	if (class->total_size_fn != NULL) {
-		size = class->total_size_fn(log, chat_type, name, account, cancellable, &error);
+		size = class->total_size_fn(log, chat_type, name, account, cancellable,
+			&error);
 
 		if (size < 0)
 			g_simple_async_result_set_from_error(simple, error);
@@ -1402,7 +1498,8 @@ total_size_thread(GSimpleAsyncResult *si
 		g_clear_error(&error);
 	} else if (class->list_fn != NULL) {
 		/* List the logs and manually size them all up */
-		GList *logs = purple_logs_get_logs(chat_type, name, account, cancellable, &error);
+		GList *logs = purple_logs_get_logs(chat_type, name, account,
+			cancellable, &error);
 		gssize total;
 
 		if (logs == NULL && error != NULL) {
@@ -1442,7 +1539,9 @@ static void
 }
 
 static void
-purple_log_real_total_size_async(PurpleLog *log, PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_total_size_async(PurpleLog *log, PurpleLogChatType chat_type,
+	const gchar *name, PurpleAccount *account, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	_thread_callback_data *callback_data;
 	GSimpleAsyncResult *simple;
@@ -1450,13 +1549,15 @@ purple_log_real_total_size_async(PurpleL
 	callback_data = g_new0(_thread_callback_data, 1);
 	callback_data->chat_type = chat_type;
 	callback_data->name = g_strdup(name);
-	callback_data->account = account; // g_object_ref
+	callback_data->account = account; /* XXX: g_object_ref */
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_total_size_async);
 
-	g_simple_async_result_set_op_res_gpointer(simple, callback_data, thread_callback_data_free);
-	g_simple_async_result_run_in_thread(simple, total_size_thread, io_priority, cancellable);
+	g_simple_async_result_set_op_res_gpointer(simple, callback_data,
+		thread_callback_data_free);
+	g_simple_async_result_run_in_thread(simple, total_size_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
@@ -1466,20 +1567,22 @@ purple_log_get_total_size_async(PurpleLo
 	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	g_return_if_fail(name != NULL);
-	g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_if_fail(account != NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	PURPLE_LOG_GET_CLASS(log)->total_size_async(log, chat_type, name, account,
 		io_priority, cancellable, cb, userdata);
 }
 
 static gssize
-purple_log_real_total_size_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_real_total_size_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	return g_simple_async_result_get_op_res_gssize(G_SIMPLE_ASYNC_RESULT(res));
 }
 
 gssize
-purple_log_get_total_size_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_get_total_size_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	g_return_val_if_fail(PURPLE_IS_LOG(log), -1);
 	g_return_val_if_fail(G_IS_ASYNC_RESULT(res), -1);
@@ -1495,7 +1598,8 @@ gssize
 }
 
 gssize
-purple_logs_get_total_size(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_logs_get_total_size(PurpleLogChatType chat_type, const gchar *name,
+	PurpleAccount *account, GCancellable *cancellable, GError **error)
 {
 	_purple_logsize_user *lu;
 	gpointer ptrsize;
@@ -1503,7 +1607,7 @@ purple_logs_get_total_size(PurpleLogChat
 	gssize total = 0;
 
 	g_return_val_if_fail(name != NULL, -1);
-	g_return_val_if_fail(account != NULL, -1); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, -1); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	lu = g_new(_purple_logsize_user, 1);
 	lu->name = g_strdup(purple_normalize(account, name));
@@ -1523,12 +1627,11 @@ purple_logs_get_total_size(PurpleLogChat
 		guint i;
 
 		for (i = 0; i < array->len; i++) {
-			PurpleLog *log;
 			GType log_type = g_array_index(array, GType, i);
-			gssize size;
+			PurpleLog *log = g_object_new(log_type, NULL);
+			gssize size = purple_log_get_total_size(log, chat_type, name,
+				account, cancellable, error);
 
-			log = g_object_new(log_type, NULL);
-			size = purple_log_get_total_size(log, chat_type, name, account, cancellable, error);
 			g_object_unref(log);
 
 			if (size < 0)
@@ -1571,11 +1674,11 @@ purple_logs_get_total_size_async(PurpleL
 	guint i;
 
 	g_return_if_fail(name != NULL);
-	g_return_if_fail(account != NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_if_fail(account != NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	lu = g_new(_purple_logsize_user, 1);
 	lu->name = g_strdup(purple_normalize(account, name));
-	lu->account = account; //g_object_ref?
+	lu->account = account; /* XXX: g_object_ref? */
 
 	callback_data = g_new0(_purple_log_total_size_callback_data, 1);
 	callback_data->cb = cb;
@@ -1585,7 +1688,7 @@ purple_logs_get_total_size_async(PurpleL
 	result = g_hash_table_lookup_extended(logsize_users, lu, NULL, &ptrsize);
 	G_UNLOCK(logsize_users);
 
-	// Fix this up?
+	/* XXX: Fix this up? */
 	if (result) {
 		size = GPOINTER_TO_INT(ptrsize);
 
@@ -1646,7 +1749,8 @@ GHashTable *
 }
 
 GHashTable *
-purple_log_get_log_sets(PurpleLog *log, GCancellable *cancellable, GError **error)
+purple_log_get_log_sets(PurpleLog *log, GCancellable *cancellable,
+	GError **error)
 {
 	PurpleLogClass *class;
 
@@ -1667,7 +1771,8 @@ static void
 }
 
 static void
-get_log_sets_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+get_log_sets_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	PurpleLog *log = PURPLE_LOG(object);
 	PurpleLogClass *class = PURPLE_LOG_GET_CLASS(log);
@@ -1675,7 +1780,9 @@ get_log_sets_thread(GSimpleAsyncResult *
 	GHashTable *sets;
 
 	if (class->get_log_sets_fn == NULL) {
-		g_simple_async_result_set_error(simple, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+		g_simple_async_result_set_error(simple,
+			G_IO_ERROR,
+			G_IO_ERROR_NOT_SUPPORTED,
 			_("Operation not supported"));
 
 		return;
@@ -1686,20 +1793,23 @@ get_log_sets_thread(GSimpleAsyncResult *
 	if (sets == NULL)
 		g_simple_async_result_set_from_error(simple, error);
 	else
-		g_simple_async_result_set_op_res_gpointer(simple, sets, (GDestroyNotify) g_hash_table_unref);
+		g_simple_async_result_set_op_res_gpointer(simple, sets,
+			(GDestroyNotify) g_hash_table_unref);
 
 	g_clear_error(&error);
 }
 
 static void
-purple_log_real_get_log_sets_async(PurpleLog *log, gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_get_log_sets_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	GSimpleAsyncResult *simple;
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_get_log_sets_async);
 
-	g_simple_async_result_run_in_thread(simple, get_log_sets_thread, io_priority, cancellable);
+	g_simple_async_result_run_in_thread(simple, get_log_sets_thread,
+		io_priority, cancellable);
 	g_object_unref(simple);
 }
 
@@ -1709,18 +1819,20 @@ purple_log_get_log_sets_async(PurpleLog 
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
 
-	PURPLE_LOG_GET_CLASS(log)->get_log_sets_async(log,
-		io_priority, cancellable, cb, userdata);
+	PURPLE_LOG_GET_CLASS(log)->get_log_sets_async(log, io_priority, cancellable,
+		cb, userdata);
 }
 
 static GHashTable * 
-purple_log_real_get_log_sets_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_real_get_log_sets_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	return g_hash_table_ref(g_simple_async_result_get_op_res_gpointer(G_SIMPLE_ASYNC_RESULT(res)));
 }
 
 GHashTable *
-purple_log_get_log_sets_finish(PurpleLog *log, GAsyncResult *res, GError **error)
+purple_log_get_log_sets_finish(PurpleLog *log, GAsyncResult *res,
+	GError **error)
 {
 	g_return_val_if_fail(log == NULL || PURPLE_IS_LOG(log), NULL);
 	g_return_val_if_fail(G_IS_ASYNC_RESULT(res), NULL);
@@ -1802,8 +1914,8 @@ purple_logs_get_log_sets_async(gint io_p
 	callback_data = g_new0(_purple_log_sets_callback_data, 1);
 	callback_data->cb = cb;
 	callback_data->userdata = userdata;
-	callback_data->sets = g_hash_table_new_full(_purple_log_set_hash, _purple_log_set_equal,
-		(GDestroyNotify) purple_log_set_free, NULL);
+	callback_data->sets = g_hash_table_new_full(_purple_log_set_hash,
+		_purple_log_set_equal, (GDestroyNotify) purple_log_set_free, NULL);
 
 	/* +1 is need special for log_get_log_sets_common_async call */
 	array = purple_log_logger_get_all();
@@ -1811,16 +1923,15 @@ purple_logs_get_log_sets_async(gint io_p
 
 	/* Get the log sets from all the loggers. */
 	for (i = 0; i < array->len; i++) {
-		PurpleLog *log;
 		GType log_type = g_array_index(array, GType, i);
+		PurpleLog *log = g_object_new(log_type, NULL);
 
-		log = g_object_new(log_type, NULL);
-
 		purple_log_get_log_sets_async(log, io_priority, cancellable,
 			log_hash_cb, callback_data);
 	}
 
-	log_get_log_sets_common_async(io_priority, cancellable, log_hash_cb, callback_data);
+	log_get_log_sets_common_async(io_priority, cancellable, log_hash_cb,
+		callback_data);
 }
 
 GHashTable *
@@ -1839,7 +1950,8 @@ gssize
 }
 
 gssize
-purple_log_get_activity_score(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account, GCancellable *cancellable, GError **error)
+purple_log_get_activity_score(PurpleLogChatType chat_type, const gchar *name,
+	PurpleAccount *account, GCancellable *cancellable, GError **error)
 {
 	_purple_logsize_user *lu;
 	gpointer ptrscore;
@@ -1848,16 +1960,17 @@ purple_log_get_activity_score(PurpleLogC
 	gssize score;
 
 	g_return_val_if_fail(name != NULL, -1);
-	g_return_val_if_fail(account != NULL, -1); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, -1); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	time(&now);
 
 	lu = g_new(_purple_logsize_user, 1);
 	lu->name = g_strdup(purple_normalize(account, name));
-	lu->account = account; //g_object_ref?
+	lu->account = account; /* XXX: g_object_ref? */
 
 	G_LOCK(logsize_users_decayed);
-	result = g_hash_table_lookup_extended(logsize_users_decayed, lu, NULL, &ptrscore);
+	result = g_hash_table_lookup_extended(logsize_users_decayed, lu, NULL,
+		&ptrscore);
 	G_UNLOCK(logsize_users_decayed);
 
 	if (result) {
@@ -1872,7 +1985,8 @@ purple_log_get_activity_score(PurpleLogC
 		for (i = 0; i < array->len; i++) {
 			GList *logs;
 
-			logs = purple_logs_get_logs(chat_type, name, account, cancellable, error);
+			logs = purple_logs_get_logs(chat_type, name, account, cancellable,
+				error);
 
 			if (logs == NULL && error != NULL)
 				return -1;
@@ -1892,7 +2006,8 @@ purple_log_get_activity_score(PurpleLogC
 				/* Activity score counts bytes in the log, exponentially
 				   decayed with a half-life of 14 days. */
 				log_time = purple_log_get_time(log);
-				score_double += size * pow(0.5, difftime(now, log_time) / 1209600.0);
+				score_double +=
+					size * pow(0.5, difftime(now, log_time) / 1209600.0);
 				g_object_unref(log);
 			}
 		}
@@ -1908,7 +2023,8 @@ static void
 }
 
 static void
-activity_score_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+activity_score_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	_thread_callback_data *callback_data =
 		g_simple_async_result_get_op_res_gpointer(simple);
@@ -1918,7 +2034,8 @@ activity_score_thread(GSimpleAsyncResult
 	gchar *name = callback_data->name;
 	gssize score;
 
-	score = purple_log_get_activity_score(chat_type, name, account, cancellable, &error);
+	score = purple_log_get_activity_score(chat_type, name, account, cancellable,
+		&error);
 
 	if (score < 0)
 		g_simple_async_result_set_from_error(simple, error);
@@ -1929,8 +2046,9 @@ void
 }
 
 void
-purple_log_get_activity_score_async(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account,
-	gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+purple_log_get_activity_score_async(PurpleLogChatType chat_type,
+	const gchar *name, PurpleAccount *account, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	_thread_callback_data *callback_data;
 	GSimpleAsyncResult *simple;
@@ -1938,13 +2056,15 @@ purple_log_get_activity_score_async(Purp
 	callback_data = g_new0(_thread_callback_data, 1);
 	callback_data->chat_type = chat_type;
 	callback_data->name = g_strdup(name);
-	callback_data->account = account; // g_object_ref
+	callback_data->account = account; /* XXX: g_object_ref */
 
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_get_activity_score_async);
 
-	g_simple_async_result_set_op_res_gpointer(simple, callback_data, thread_callback_data_free);
-	g_simple_async_result_run_in_thread(simple, activity_score_thread, io_priority, cancellable);
+	g_simple_async_result_set_op_res_gpointer(simple, callback_data,
+		thread_callback_data_free);
+	g_simple_async_result_run_in_thread(simple, activity_score_thread,
+		io_priority, cancellable);
 	g_object_unref(simple);
 }
 
@@ -1999,7 +2119,8 @@ static void
 }
 
 static void
-remove_thread(GSimpleAsyncResult *simple, GObject *object, GCancellable *cancellable)
+remove_thread(GSimpleAsyncResult *simple, GObject *object,
+	GCancellable *cancellable)
 {
 	PurpleLog *log = PURPLE_LOG(object);
 	GError *error = NULL;
@@ -2016,8 +2137,8 @@ static void
 }
 
 static void
-purple_log_real_remove_async(PurpleLog *log, gint io_priority, GCancellable *cancellable,
-	GAsyncReadyCallback cb, gpointer userdata)
+purple_log_real_remove_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	GSimpleAsyncResult *simple;
 
@@ -2026,18 +2147,19 @@ purple_log_real_remove_async(PurpleLog *
 	simple = g_simple_async_result_new(G_OBJECT(log), cb, userdata,
 		purple_log_real_remove_async);
 
-	g_simple_async_result_run_in_thread(simple, remove_thread, io_priority, cancellable);
+	g_simple_async_result_run_in_thread(simple, remove_thread, io_priority,
+		cancellable);
 	g_object_unref(simple);
 }
 
 void
-purple_log_remove_async(PurpleLog *log, gint io_priority, GCancellable *cancellable,
-	GAsyncReadyCallback cb, gpointer userdata)
+purple_log_remove_async(PurpleLog *log, gint io_priority,
+	GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
 {
 	g_return_if_fail(PURPLE_IS_LOG(log));
 
-	PURPLE_LOG_GET_CLASS(log)->remove_async(log, io_priority,
-		cancellable, cb, userdata);
+	PURPLE_LOG_GET_CLASS(log)->remove_async(log, io_priority, cancellable, cb,
+		userdata);
 }
 
 static gboolean
@@ -2063,7 +2185,8 @@ gchar *
 }
 
 gchar *
-purple_log_get_log_dir(PurpleLogChatType chat_type, const gchar *name, PurpleAccount *account)
+purple_log_get_log_dir(PurpleLogChatType chat_type, const gchar *name,
+	PurpleAccount *account)
 {
 	PurplePlugin *prpl;
 	PurplePluginProtocolInfo *prpl_info;
@@ -2071,7 +2194,7 @@ purple_log_get_log_dir(PurpleLogChatType
 	gchar *acct_name, *dir, *temp;
 
 	g_return_val_if_fail(name != NULL, NULL);
-	g_return_val_if_fail(account != NULL, NULL); // PURPLE_IS_ACCOUNT(account)
+	g_return_val_if_fail(account != NULL, NULL); /* XXX: PURPLE_IS_ACCOUNT(account) */
 
 	prpl = purple_find_prpl(purple_account_get_protocol_id(account));
 
@@ -2130,7 +2253,8 @@ static void
  ****************************************************************************/
 
 static void
-logger_pref_cb(const gchar *name, PurplePrefType type, gconstpointer value, gpointer data)
+logger_pref_cb(const gchar *name, PurplePrefType type, gconstpointer value,
+	gpointer data)
 {
 	GArray *array;
 	guint i;
@@ -2173,7 +2297,8 @@ purple_log_logger_add(GType log_type)
 
 	class = g_type_class_ref(log_type);
 
-	if (purple_strequal(purple_prefs_get_string("/purple/logging/format"), class->logger_id))
+	if (purple_strequal(purple_prefs_get_string("/purple/logging/format"),
+			class->logger_id))
 		purple_prefs_trigger_callback("/purple/logging/format");
 }
 
@@ -2275,7 +2400,8 @@ purple_log_set_compare(gconstpointer y, 
 	 * exist if one logger knows the account and another
 	 * doesn't. */
 	if (a->account != NULL && b->account != NULL) {
-		ret = strcmp(purple_account_get_username(a->account), purple_account_get_username(b->account));
+		ret = strcmp(purple_account_get_username(a->account),
+			purple_account_get_username(b->account));
 
 		if (ret != 0)
 			return ret;
@@ -2294,18 +2420,22 @@ _purple_log_set_hash(gconstpointer key)
 {
 	const PurpleLogSet *set = key;
 
-	/* The account isn't hashed because we need PurpleLogSets with NULL accounts
+	/**
+	 * The account isn't hashed because we need PurpleLogSets with NULL accounts
 	 * to be found when we search by a PurpleLogSet that has a non-NULL account
-	 * but the same type and name. */
+	 * but the same type and name.
+	 */
 	return g_int_hash(&set->type) + g_str_hash(set->name);
 }
 
 gboolean
 _purple_log_set_equal(gconstpointer a, gconstpointer b)
 {
-	/* I realize that the choices made for GList and GHashTable
+	/**
+	 * I realize that the choices made for GList and GHashTable
 	 * make sense for those data types, but I wish the comparison
-	 * functions were compatible. */
+	 * functions were compatible.
+	 */
 	return !purple_log_set_compare(a, b);
 }
 
@@ -2540,7 +2670,8 @@ log_get_log_sets_common(GCancellable *ca
 		while ((username = g_dir_read_name(protocol_dir)) != NULL) {
 			PurpleAccount *account = NULL;
 			const gchar *username_unescaped;
-			gchar *username_path = g_build_filename(protocol_path, username, NULL);
+			gchar *username_path = g_build_filename(protocol_path, username,
+				NULL);
 			gchar *name;
 
 			if ((username_dir = g_dir_open(username_path, 0, NULL)) == NULL) {
@@ -2551,8 +2682,13 @@ log_get_log_sets_common(GCancellable *ca
 			/* Find the account for username in the list of accounts for protocol. */
 			username_unescaped = purple_unescape_filename(username);
 
-			for (account_iter = g_list_first(accounts); account_iter != NULL; account_iter = g_list_next(account_iter)) {
-				if (purple_strequal(((PurpleAccount *) account_iter->data)->username, username_unescaped)) {
+			for (account_iter = g_list_first(accounts);
+				account_iter != NULL;
+				account_iter = g_list_next(account_iter))
+			{
+				if (purple_strequal(((PurpleAccount *) account_iter->data)->username,
+					username_unescaped))
+				{
 					account = account_iter->data;
 					break;
 				}
@@ -2631,17 +2767,20 @@ log_get_log_sets_common_thread(GSimpleAs
 	if (sets == NULL)
 		g_simple_async_result_set_from_error(simple, error);
 	else
-		g_simple_async_result_set_op_res_gpointer(simple, sets, (GDestroyNotify) g_hash_table_unref);
+		g_simple_async_result_set_op_res_gpointer(simple, sets,
+			(GDestroyNotify) g_hash_table_unref);
 
 	g_clear_error(&error);
 }
 
 static void
-log_get_log_sets_common_async(gint io_priority, GCancellable *cancellable, GAsyncReadyCallback cb, gpointer userdata)
+log_get_log_sets_common_async(gint io_priority, GCancellable *cancellable,
+	GAsyncReadyCallback cb, gpointer userdata)
 {
 	GSimpleAsyncResult *simple;
 
-	simple = g_simple_async_result_new(NULL, cb, userdata, log_get_log_sets_common_async);
+	simple = g_simple_async_result_new(NULL, cb, userdata,
+		log_get_log_sets_common_async);
 
 	g_simple_async_result_run_in_thread(simple, log_get_log_sets_common_thread,
 		io_priority, cancellable);
@@ -2765,7 +2904,8 @@ log_total_size_cb(GObject *object, GAsyn
 			simple = g_simple_async_result_new(NULL, callback_data->cb,
 				callback_data->userdata, purple_logs_get_total_size_async);
 
-			g_simple_async_result_set_op_res_gssize(simple, callback_data->total);
+			g_simple_async_result_set_op_res_gssize(simple,
+				callback_data->total);
 			g_simple_async_result_complete_in_idle(simple);
 
 			g_object_unref(simple);
@@ -2791,7 +2931,8 @@ log_hash_cb(GObject *object, GAsyncResul
 				log != NULL ? PURPLE_LOG_GET_CLASS(log)->logger_name : "log_get_log_sets_common",
 				error->message);
 	} else {
-		g_hash_table_foreach_steal(one_set, steal_log_sets, callback_data->sets);
+		g_hash_table_foreach_steal(one_set, steal_log_sets,
+			callback_data->sets);
 		g_hash_table_destroy(one_set);
 	}
 
@@ -2804,8 +2945,8 @@ log_hash_cb(GObject *object, GAsyncResul
 			simple = g_simple_async_result_new(object, callback_data->cb,
 				callback_data->userdata, log_get_log_sets_common_async);
 
-			g_simple_async_result_set_op_res_gpointer(simple, callback_data->sets,
-				(GDestroyNotify) g_hash_table_unref);
+			g_simple_async_result_set_op_res_gpointer(simple,
+				callback_data->sets, (GDestroyNotify) g_hash_table_unref);
 			g_simple_async_result_complete_in_idle(simple);
 
 			g_object_unref(simple);


More information about the Commits mailing list