Skip to content
Snippets Groups Projects
Commit d7ef39d2 authored by George Kiagiadakis's avatar George Kiagiadakis
Browse files

properties: rename _copy_all() to _update() to match the pw_properties API

... and use pw_properties_update() underneath
parent 306f75d3
No related branches found
No related tags found
No related merge requests found
...@@ -320,6 +320,26 @@ wp_properties_unref (WpProperties * self) ...@@ -320,6 +320,26 @@ wp_properties_unref (WpProperties * self)
g_rc_box_release_full (self, (GDestroyNotify) wp_properties_free); 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: * wp_properties_update_from_dict:
* @self: a properties object * @self: a properties object
...@@ -389,29 +409,6 @@ wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst, ...@@ -389,29 +409,6 @@ wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst,
return changed; 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: * wp_properties_get:
* @self: a properties object * @self: a properties object
......
...@@ -64,6 +64,9 @@ WpProperties * wp_properties_ref (WpProperties * self); ...@@ -64,6 +64,9 @@ WpProperties * wp_properties_ref (WpProperties * self);
WP_API WP_API
void wp_properties_unref (WpProperties * self); void wp_properties_unref (WpProperties * self);
WP_API
gint wp_properties_update (WpProperties * self, WpProperties * props);
WP_API WP_API
gint wp_properties_update_from_dict (WpProperties * self, gint wp_properties_update_from_dict (WpProperties * self,
const struct spa_dict * dict); const struct spa_dict * dict);
...@@ -76,9 +79,6 @@ WP_API ...@@ -76,9 +79,6 @@ WP_API
gint wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst, gint wp_properties_copy_keys_valist (WpProperties * src, WpProperties * dst,
const gchar *key1, va_list args); const gchar *key1, va_list args);
WP_API
void wp_properties_copy_all (WpProperties * src, WpProperties * dst);
WP_API WP_API
const gchar * wp_properties_get (WpProperties * self, const gchar * key); const gchar * wp_properties_get (WpProperties * self, const gchar * key);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment