[tracker] libtracker-data: Remove tracker_dbus_query_result_to_ptr_array



commit 92cebab5d6e81076207359d31bbc65400c15c1bf
Author: Jürg Billeter <j bitron ch>
Date:   Tue Dec 28 08:59:46 2010 +0100

    libtracker-data: Remove tracker_dbus_query_result_to_ptr_array
    
    The function was not used.

 src/libtracker-data/tracker-db-dbus.c        |   56 --------------------------
 src/libtracker-data/tracker-db-dbus.h        |    1 -
 tests/libtracker-data/tracker-db-dbus-test.c |   49 ----------------------
 3 files changed, 0 insertions(+), 106 deletions(-)
---
diff --git a/src/libtracker-data/tracker-db-dbus.c b/src/libtracker-data/tracker-db-dbus.c
index 05b70bf..b99c63c 100644
--- a/src/libtracker-data/tracker-db-dbus.c
+++ b/src/libtracker-data/tracker-db-dbus.c
@@ -70,59 +70,3 @@ tracker_dbus_query_result_to_strv (TrackerDBResultSet *result_set,
 
 	return strv;
 }
-
-GPtrArray *
-tracker_dbus_query_result_to_ptr_array (TrackerDBResultSet *result_set)
-{
-	GPtrArray *ptr_array;
-	gboolean   valid = FALSE;
-	gint       columns;
-	gint       i;
-
-	ptr_array = g_ptr_array_new ();
-
-	if (result_set) {
-		valid = TRUE;
-
-		/* Make sure we rewind before iterating the result set */
-		tracker_db_result_set_rewind (result_set);
-
-		/* Find out how many columns to iterate */
-		columns = tracker_db_result_set_get_n_columns (result_set);
-	}
-
-	while (valid) {
-		gchar  **p;
-
-		p = g_new0 (gchar *, columns + 1);
-
-		/* Append fields to the array */
-		for (i = 0; i < columns; i++) {
-			GValue  transform = { 0, };
-			GValue  value = { 0, };
-
-			g_value_init (&transform, G_TYPE_STRING);
-
-			_tracker_db_result_set_get_value (result_set, i, &value);
-
-			if (G_IS_VALUE (&value) && g_value_transform (&value, &transform)) {
-				p[i] = g_value_dup_string (&transform);
-			}
-
-			if (!p[i]) {
-				p[i] = g_strdup ("");
-			}
-
-			if (G_IS_VALUE (&value)) {
-				g_value_unset (&value);
-			}
-			g_value_unset (&transform);
-		}
-
-		g_ptr_array_add (ptr_array, p);
-
-		valid = tracker_db_result_set_iter_next (result_set);
-	}
-
-	return ptr_array;
-}
diff --git a/src/libtracker-data/tracker-db-dbus.h b/src/libtracker-data/tracker-db-dbus.h
index 86d82c3..0cdaa56 100644
--- a/src/libtracker-data/tracker-db-dbus.h
+++ b/src/libtracker-data/tracker-db-dbus.h
@@ -34,7 +34,6 @@ G_BEGIN_DECLS
 gchar **    tracker_dbus_query_result_to_strv            (TrackerDBResultSet *result_set,
                                                           gint                column,
                                                           gint               *count);
-GPtrArray * tracker_dbus_query_result_to_ptr_array       (TrackerDBResultSet *result_set);
 
 G_END_DECLS
 
diff --git a/tests/libtracker-data/tracker-db-dbus-test.c b/tests/libtracker-data/tracker-db-dbus-test.c
index e5ecfde..5c11e99 100644
--- a/tests/libtracker-data/tracker-db-dbus-test.c
+++ b/tests/libtracker-data/tracker-db-dbus-test.c
@@ -194,53 +194,6 @@ test_dbus_query_result_to_strv ()
 
 }
 
-static void
-free_string_ptr_array (GPtrArray *array)
-{
-	g_ptr_array_foreach (array, (GFunc)g_strfreev, NULL);
-	g_ptr_array_free (array, TRUE);
-}
-
-static void
-test_dbus_query_result_to_ptr_array ()
-{
-	TrackerDBResultSet *result_set = NULL;
-	GPtrArray *result = NULL;
-
-	/* NULL */
-	result = tracker_dbus_query_result_to_ptr_array (result_set);
-	g_assert_cmpint (result->len, ==, 0);
-	free_string_ptr_array (result);
-
-	/* 5 results, 1 column */
-	result_set = get_mock_tracker_db_result (5, 1, FALSE);
-	result = tracker_dbus_query_result_to_ptr_array (result_set);
-
-	g_assert_cmpint (result->len, ==, 5);
-	free_string_ptr_array (result);
-
-	g_object_unref (result_set);
-
-	/* 0 results, 1 columns */
-	result_set = get_mock_tracker_db_result (0, 1, FALSE);
-	if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
-		result = tracker_dbus_query_result_to_ptr_array (result_set);
-		free_string_ptr_array (result);
-	}
-	g_test_trap_assert_failed ();
-	/* Should raise g_critical (priv->array...); */
-
-	g_object_unref (result_set);
-
-	/*  1 result ... NULL */
-	result_set = get_mock_tracker_db_result (1, 1, TRUE);
-	result = tracker_dbus_query_result_to_ptr_array (result_set);
-	g_assert_cmpint (result->len, ==, 1);
-	free_string_ptr_array (result);
-
-	g_object_unref (result_set);
-}
-
 gint
 main (gint argc, gchar **argv)
 {
@@ -252,8 +205,6 @@ main (gint argc, gchar **argv)
 
 	g_test_add_func ("/libtracker-db/tracker-db-dbus/query_result_to_strv",
 	                 test_dbus_query_result_to_strv);
-	g_test_add_func ("/libtracker-db/tracker-db-dbus/query_result_to_ptr_array",
-	                 test_dbus_query_result_to_ptr_array);
 	result = g_test_run ();
 
 	/* End */



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