Blame SOURCES/0001-Don-t-use-g_strv_equals.patch

48d427
From 72fa3eca32d764f35b46642337c46ecc9b851177 Mon Sep 17 00:00:00 2001
48d427
From: =?UTF-8?q?Jonas=20=C3=85dahl?= <jadahl@gmail.com>
48d427
Date: Mon, 25 May 2020 21:31:07 +0200
48d427
Subject: [PATCH] Don't use g_strv_equals
48d427
48d427
---
48d427
 tests/backend/email.c | 25 ++++++++++++++++++++++---
48d427
 tests/filechooser.c   | 23 +++++++++++++++++++++--
48d427
 2 files changed, 43 insertions(+), 5 deletions(-)
48d427
48d427
diff --git a/tests/backend/email.c b/tests/backend/email.c
48d427
index 7d8844f..bab4ac6 100644
48d427
--- a/tests/backend/email.c
48d427
+++ b/tests/backend/email.c
48d427
@@ -31,6 +31,25 @@ email_handle_free (EmailHandle *handle)
48d427
   g_free (handle);
48d427
 }
48d427
 
48d427
+static gboolean
48d427
+strv_equal (const gchar * const *strv1,
48d427
+            const gchar * const *strv2)
48d427
+{
48d427
+  g_return_val_if_fail (strv1 != NULL, FALSE);
48d427
+  g_return_val_if_fail (strv2 != NULL, FALSE);
48d427
+
48d427
+  if (strv1 == strv2)
48d427
+    return TRUE;
48d427
+
48d427
+  for (; *strv1 != NULL && *strv2 != NULL; strv1++, strv2++)
48d427
+    {
48d427
+      if (!g_str_equal (*strv1, *strv2))
48d427
+        return FALSE;
48d427
+    }
48d427
+
48d427
+  return (*strv1 == NULL && *strv2 == NULL);
48d427
+}
48d427
+
48d427
 static gboolean
48d427
 send_response (gpointer data)
48d427
 {
48d427
@@ -70,7 +89,7 @@ send_response (gpointer data)
48d427
   if (strv)
48d427
     {
48d427
       g_assert (addresses != NULL);
48d427
-      g_assert_true (g_strv_equal ((const char * const *)strv, addresses));
48d427
+      g_assert_true (strv_equal ((const char * const *)strv, addresses));
48d427
       g_strfreev (strv);
48d427
     }
48d427
 
48d427
@@ -78,7 +97,7 @@ send_response (gpointer data)
48d427
   if (strv)
48d427
     {
48d427
       g_assert (addresses != NULL);
48d427
-      g_assert_true (g_strv_equal ((const char * const *)strv, cc));
48d427
+      g_assert_true (strv_equal ((const char * const *)strv, cc));
48d427
       g_strfreev (strv);
48d427
     }
48d427
 
48d427
@@ -86,7 +105,7 @@ send_response (gpointer data)
48d427
   if (strv)
48d427
     {
48d427
       g_assert (addresses != NULL);
48d427
-      g_assert_true (g_strv_equal ((const char * const *)strv, bcc));
48d427
+      g_assert_true (strv_equal ((const char * const *)strv, bcc));
48d427
       g_strfreev (strv);
48d427
     }
48d427
 
48d427
diff --git a/tests/filechooser.c b/tests/filechooser.c
48d427
index a5f9b2c..a1a17cd 100644
48d427
--- a/tests/filechooser.c
48d427
+++ b/tests/filechooser.c
48d427
@@ -12,6 +12,25 @@ extern char outdir[];
48d427
 
48d427
 static int got_info;
48d427
 
48d427
+static gboolean
48d427
+strv_equal (const gchar * const *strv1,
48d427
+            const gchar * const *strv2)
48d427
+{
48d427
+  g_return_val_if_fail (strv1 != NULL, FALSE);
48d427
+  g_return_val_if_fail (strv2 != NULL, FALSE);
48d427
+
48d427
+  if (strv1 == strv2)
48d427
+    return TRUE;
48d427
+
48d427
+  for (; *strv1 != NULL && *strv2 != NULL; strv1++, strv2++)
48d427
+    {
48d427
+      if (!g_str_equal (*strv1, *strv2))
48d427
+        return FALSE;
48d427
+    }
48d427
+
48d427
+  return (*strv1 == NULL && *strv2 == NULL);
48d427
+}
48d427
+
48d427
 static void
48d427
 open_file_cb (GObject *obj,
48d427
                  GAsyncResult *result,
48d427
@@ -41,7 +60,7 @@ open_file_cb (GObject *obj,
48d427
       g_variant_lookup (ret, "uris", "^a&s", &uris;;
48d427
       expected_uris = g_key_file_get_string_list (keyfile, "result", "uris", NULL, NULL);
48d427
 
48d427
-      g_assert (g_strv_equal (uris, (const char * const *)expected_uris)); 
48d427
+      g_assert (strv_equal (uris, (const char * const *)expected_uris)); 
48d427
 
48d427
       expected_choices = g_key_file_get_string (keyfile, "result", "choices", NULL);
48d427
       g_variant_lookup (ret, "choices", "@a(ss)", &choices);
48d427
@@ -670,7 +689,7 @@ save_file_cb (GObject *obj,
48d427
       g_variant_lookup (ret, "uris", "^a&s", &uris;;
48d427
       expected = g_key_file_get_string_list (keyfile, "result", "uris", NULL, NULL);
48d427
 
48d427
-      g_assert (g_strv_equal (uris, (const char * const *)expected)); 
48d427
+      g_assert (strv_equal (uris, (const char * const *)expected)); 
48d427
     }
48d427
   else if (response == 1)
48d427
     g_assert_error (error, G_IO_ERROR, G_IO_ERROR_CANCELLED);
48d427
-- 
48d427
2.26.2
48d427