From d7ef39d2d14b7fe483a443f3bf2fcb93459a69f1 Mon Sep 17 00:00:00 2001
From: George Kiagiadakis <george.kiagiadakis@collabora.com>
Date: Tue, 31 Mar 2020 11:07:28 +0300
Subject: [PATCH] properties: rename _copy_all() to _update() to match the
 pw_properties API

... and use pw_properties_update() underneath
---
 lib/wp/properties.c | 43 ++++++++++++++++++++-----------------------
 lib/wp/properties.h |  6 +++---
 2 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/lib/wp/properties.c b/lib/wp/properties.c
index 2fe981f5..8f173b35 100644
--- a/lib/wp/properties.c
+++ b/lib/wp/properties.c
@@ -320,6 +320,26 @@ wp_properties_unref (WpProperties * self)
   g_rc_box_release_full (self, (GDestroyNotify) wp_properties_free);
 }
 
+/**
+ * wp_properties_update:
+ * @self: a properties object
+ * @props: a properties set that contains properties to update
+ *
+ * Updates (adds new or modifies existing) properties in @self, using the
+ * given @props as a source. Any properties that are not contained in @props
+ * are left untouched.
+ *
+ * Returns: the number of properties that were changed
+ */
+gint
+wp_properties_update (WpProperties * self, WpProperties * props)
+{
+  g_return_val_if_fail (self != NULL, -EINVAL);
+  g_return_val_if_fail (!(self->flags & FLAG_IS_DICT), -EINVAL);
+
+  return pw_properties_update (self->props, wp_properties_peek_dict (props));
+}
+
 /**
  * wp_properties_update_from_dict:
  * @self: a properties object
@@ -389,29 +409,6 @@ wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst,
   return changed;
 }
 
-
-/**
- * wp_properties_copy_all:
- * @src: the source properties set
- * @dst: the destination properties set
- *
- * Copies all the properties contained in @src into @dst
- */
-void
-wp_properties_copy_all (WpProperties * src, WpProperties * dst)
-{
-  const struct spa_dict * dict;
-  const struct spa_dict_item *item;
-
-  g_return_if_fail (src != NULL);
-  g_return_if_fail (dst != NULL);
-
-  dict = wp_properties_peek_dict (src);
-  spa_dict_for_each(item, dict) {
-    wp_properties_set (dst, item->key, item->value);
-  }
-}
-
 /**
  * wp_properties_get:
  * @self: a properties object
diff --git a/lib/wp/properties.h b/lib/wp/properties.h
index 69d28828..8a5d471e 100644
--- a/lib/wp/properties.h
+++ b/lib/wp/properties.h
@@ -64,6 +64,9 @@ WpProperties * wp_properties_ref (WpProperties * self);
 WP_API
 void wp_properties_unref (WpProperties * self);
 
+WP_API
+gint wp_properties_update (WpProperties * self, WpProperties * props);
+
 WP_API
 gint wp_properties_update_from_dict (WpProperties * self,
     const struct spa_dict * dict);
@@ -76,9 +79,6 @@ WP_API
 gint wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst,
     const gchar *key1, va_list args);
 
-WP_API
-void wp_properties_copy_all (WpProperties * src, WpProperties * dst);
-
 WP_API
 const gchar * wp_properties_get (WpProperties * self, const gchar * key);
 
-- 
GitLab