[tracker] libtracker-common: Remove unused functions tracker_dbus_queue_*
- From: Jürg Billeter <juergbi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [tracker] libtracker-common: Remove unused functions tracker_dbus_queue_*
- Date: Tue, 28 Dec 2010 08:37:32 +0000 (UTC)
commit ec3e5ac5625e7566ccb6c9de1165c6a974a232ba
Author: Jürg Billeter <j bitron ch>
Date: Tue Dec 28 09:26:03 2010 +0100
libtracker-common: Remove unused functions tracker_dbus_queue_*
src/libtracker-common/tracker-dbus.c | 80 ----------------------
src/libtracker-common/tracker-dbus.h | 4 -
tests/libtracker-common/tracker-dbus-test.c | 98 ---------------------------
3 files changed, 0 insertions(+), 182 deletions(-)
---
diff --git a/src/libtracker-common/tracker-dbus.c b/src/libtracker-common/tracker-dbus.c
index 26f3869..9ee4e53 100644
--- a/src/libtracker-common/tracker-dbus.c
+++ b/src/libtracker-common/tracker-dbus.c
@@ -331,86 +331,6 @@ tracker_dbus_slist_to_strv (GSList *list)
return strv;
}
-gchar **
-tracker_dbus_queue_str_to_strv (GQueue *queue,
- gint max)
-{
- gchar **strv;
- gchar *str;
- gint i, j;
- gint length;
-
- length = g_queue_get_length (queue);
-
- if (max > 0) {
- length = MIN (max, length);
- }
-
- strv = g_new0 (gchar*, length + 1);
-
- for (i = 0, j = 0; i < length; i++) {
- str = g_queue_pop_head (queue);
-
- if (!str) {
- break;
- }
-
- if (!g_utf8_validate (str, -1, NULL)) {
- g_message ("Could not add string:'%s' to GStrv, invalid UTF-8", str);
- g_free (str);
- continue;
- }
-
- strv[j++] = str;
- }
-
- strv[j] = NULL;
-
- return strv;
-}
-
-gchar **
-tracker_dbus_queue_gfile_to_strv (GQueue *queue,
- gint max)
-{
- gchar **strv;
- gchar *str;
- GFile *file;
- gint i, j;
- gint length;
-
- length = g_queue_get_length (queue);
-
- if (max > 0) {
- length = MIN (max, length);
- }
-
- strv = g_new0 (gchar*, length + 1);
-
- for (i = 0, j = 0; i < length; i++) {
- file = g_queue_pop_head (queue);
-
- if (!file) {
- break;
- }
-
- str = g_file_get_path (file);
- g_object_unref (file);
-
- if (!g_utf8_validate (str, -1, NULL)) {
- g_message ("Could not add string:'%s' to GStrv, invalid UTF-8", str);
- g_free (str);
- continue;
- }
-
- strv[j++] = str;
- }
-
- strv[j] = NULL;
-
- return strv;
-}
-
void
tracker_dbus_results_ptr_array_free (GPtrArray **ptr_array)
{
diff --git a/src/libtracker-common/tracker-dbus.h b/src/libtracker-common/tracker-dbus.h
index d2b5ea4..3e8f715 100644
--- a/src/libtracker-common/tracker-dbus.h
+++ b/src/libtracker-common/tracker-dbus.h
@@ -125,10 +125,6 @@ GQuark tracker_dbus_error_quark (void);
/* Utils */
gchar ** tracker_dbus_slist_to_strv (GSList *list);
-gchar ** tracker_dbus_queue_str_to_strv (GQueue *queue,
- gint max);
-gchar ** tracker_dbus_queue_gfile_to_strv (GQueue *queue,
- gint max);
void tracker_dbus_results_ptr_array_free (GPtrArray **ptr_array);
/* Requests */
diff --git a/tests/libtracker-common/tracker-dbus-test.c b/tests/libtracker-common/tracker-dbus-test.c
index 9412bf6..08c4af0 100644
--- a/tests/libtracker-common/tracker-dbus-test.c
+++ b/tests/libtracker-common/tracker-dbus-test.c
@@ -75,50 +75,6 @@ test_slist_to_strv_nonutf8 (void)
#endif
-static void
-async_queue_to_strv (gboolean utf8)
-{
- GQueue *queue;
- gint i;
- gchar **queue_as_strv;
- gint strings = 5;
-
- queue = g_queue_new ();
-
- for (i = 0; i < strings; i++) {
- if (utf8) {
- g_queue_push_tail (queue, g_strdup_printf ("%d", i));
- } else {
- g_queue_push_tail (queue, g_strdup (tracker_test_helpers_get_nonutf8 ()));
- }
- }
- g_assert_cmpint (g_queue_get_length (queue), ==, strings);
-
- if (utf8) {
- queue_as_strv = tracker_dbus_queue_str_to_strv (queue, g_queue_get_length (queue));
- g_assert_cmpint (g_strv_length (queue_as_strv), ==, strings);
- g_strfreev (queue_as_strv);
- } else {
- if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDERR)) {
- queue_as_strv = tracker_dbus_queue_str_to_strv (queue, g_queue_get_length (queue));
- g_strfreev (queue_as_strv);
- }
- /* Error message:
- * Could not add string:'/invalid/file/\xe4\xf6\xe590808.' to GStrv, invalid UTF-8
- */
- g_test_trap_assert_stderr ("*Could not add string:*");
- }
-
- /* Queue empty by tracker_dbus_async_queue_to_strv */
- g_queue_free (queue);
-}
-
-static void
-test_async_queue_to_strv (void)
-{
- async_queue_to_strv (TRUE);
-}
-
#if 0
static void
@@ -194,56 +150,6 @@ test_dbus_request_failed (void)
g_test_trap_assert_stderr ("*Unset error and no error message*");
}
-static GQueue *
-helper_get_queue_with_gfiles (int n)
-{
- GQueue *queue;
- gchar *filename;
- GFile *file;
- gint i;
-
- queue = g_queue_new ();
- for (i = 0; i < n; i++) {
- filename = g_strdup_printf ("/test/file/%d", i);
- file = g_file_new_for_path (filename);
- g_queue_push_head (queue, file);
- g_free (filename);
- }
- return queue;
-}
-
-static void
-test_dbus_gfile_queue_to_strv ()
-{
- GQueue *queue;
- int i;
- gchar *filename;
- gchar **result = NULL;
-
- queue = helper_get_queue_with_gfiles (10);
- result = tracker_dbus_queue_gfile_to_strv (queue, 100);
- g_assert (result);
- g_assert_cmpint (g_strv_length (result), ==, 10);
- g_assert_cmpint (g_queue_get_length (queue), ==, 0);
-
- /*
- * It is a FILO queue
- */
- for (i = 0; i < 10; i++) {
- filename = g_strdup_printf ("/test/file/%d", 9 - i);
- g_assert_cmpstr (result[i], ==, filename);
- g_free (filename);
- }
-
- /* test max < number of elements in the queue */
- queue = helper_get_queue_with_gfiles (10);
- result = tracker_dbus_queue_gfile_to_strv (queue, 5);
- g_assert (result);
- g_assert_cmpint (g_strv_length (result), ==, 5);
- g_assert_cmpint (g_queue_get_length (queue), ==, 5);
-
-}
-
static void
test_dbus_request ()
{
@@ -506,12 +412,8 @@ main (int argc, char **argv) {
g_test_add_func ("/libtracker-common/tracker-dbus/slist_to_strv_ok",
test_slist_to_strv);
- g_test_add_func ("/libtracker-common/tracker-dbus/async_queue_to_strv_ok",
- test_async_queue_to_strv);
g_test_add_func ("/libtracker-common/tracker-dbus/free_ptr_array",
test_results_ptr_array_free);
- g_test_add_func ("/libtracker-common/tracker-dbus/gfile_queue_to_strv",
- test_dbus_gfile_queue_to_strv);
g_test_add_func ("/libtracker-common/tracker-dbus/request",
test_dbus_request);
g_test_add_func ("/libtracker-common/tracker-dbus/request-client-lookup",
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]