[tracker/rss-enclosures] libtracker-data: improved collation related debugging traces



commit ecfe3dca93b0969656b24a5e5e8cc7beda08bd42
Author: Aleksander Morgado <aleksander lanedo com>
Date:   Fri Oct 15 16:39:18 2010 +0200

    libtracker-data: improved collation related debugging traces

 src/libtracker-data/tracker-collation.c |   35 ++++++++++++++++--------------
 1 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/src/libtracker-data/tracker-collation.c b/src/libtracker-data/tracker-collation.c
index ecde014..22d21ab 100644
--- a/src/libtracker-data/tracker-collation.c
+++ b/src/libtracker-data/tracker-collation.c
@@ -77,10 +77,11 @@ tracker_collation_utf8 (gpointer      collator,
 	memcpy (aux1, str1, len1); aux1[len1] = '\0';
 	memcpy (aux2, str2, len2); aux2[len2] = '\0';
 
-	trace ("(libunistring) Collating '%s' and '%s'", aux1, aux2);
-
 	result = u8_strcoll (aux1, aux2);
 
+	trace ("(libunistring) Collating '%s' and '%s' (%d)",
+	       aux1, aux2, result);
+
 	if (len1 >= MAX_STACK_STR_SIZE)
 		g_free (aux1);
 	if (len2 >= MAX_STACK_STR_SIZE)
@@ -135,6 +136,17 @@ tracker_collation_utf8 (gpointer      collator,
 	/* Collator must be created before trying to collate */
 	g_return_val_if_fail (collator, -1);
 
+	/* Setup iterators */
+	uiter_setUTF8 (&iter1, str1, len1);
+	uiter_setUTF8 (&iter2, str2, len2);
+
+	result = ucol_strcollIter ((UCollator *)collator,
+	                           &iter1,
+	                           &iter2,
+	                           &status);
+	if (status != U_ZERO_ERROR)
+		g_critical ("Error collating: %s", u_errorName (status));
+
 #ifdef ENABLE_TRACE
 	{
 		gchar *aux1;
@@ -147,7 +159,8 @@ tracker_collation_utf8 (gpointer      collator,
 		memcpy (aux1, str1, len1); aux1[len1] = '\0';
 		memcpy (aux2, str2, len2); aux2[len2] = '\0';
 
-		trace ("(ICU) Collating '%s' and '%s'", aux1, aux2);
+		trace ("(ICU) Collating '%s' and '%s' (%d)",
+		       aux1, aux2, result);
 
 		if (len1 >= MAX_STACK_STR_SIZE)
 			g_free (aux1);
@@ -156,17 +169,6 @@ tracker_collation_utf8 (gpointer      collator,
 	}
 #endif /* ENABLE_TRACE */
 
-	/* Setup iterators */
-	uiter_setUTF8 (&iter1, str1, len1);
-	uiter_setUTF8 (&iter2, str2, len2);
-
-	result = ucol_strcollIter ((UCollator *)collator,
-	                           &iter1,
-	                           &iter2,
-	                           &status);
-	if (status != U_ZERO_ERROR)
-		g_critical ("Error collating: %s", u_errorName (status));
-
 	if (result == UCOL_GREATER)
 		return 1;
 	if (result == UCOL_LESS)
@@ -208,10 +210,11 @@ tracker_collation_utf8 (gpointer      collator,
 	memcpy (aux1, str1, len1); aux1[len1] = '\0';
 	memcpy (aux2, str2, len2); aux2[len2] = '\0';
 
-	trace ("(GLib) Collating '%s' and '%s'", aux1, aux2);
-
 	result = g_utf8_collate (aux1, aux2);
 
+	trace ("(GLib) Collating '%s' and '%s' (%d)",
+	       aux1, aux2, result);
+
 	if (len1 >= MAX_STACK_STR_SIZE)
 		g_free (aux1);
 	if (len2 >= MAX_STACK_STR_SIZE)



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]