Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
W
wireplumber
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pkg
wireplumber
Commits
0c6ef834
Commit
0c6ef834
authored
5 years ago
by
George Kiagiadakis
Browse files
Options
Downloads
Patches
Plain Diff
lib: properties: add wp_properties_copy_keys
A method to copy specific keys from one properties set to another
parent
cc3f01b2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/wp/properties.c
+26
-0
26 additions, 0 deletions
lib/wp/properties.c
lib/wp/properties.h
+5
-0
5 additions, 0 deletions
lib/wp/properties.h
with
31 additions
and
0 deletions
lib/wp/properties.c
+
26
−
0
View file @
0c6ef834
...
...
@@ -178,6 +178,32 @@ wp_properties_update_from_dict (WpProperties * self,
return
pw_properties_update
(
self
->
props
,
dict
);
}
gint
wp_properties_copy_keys
(
WpProperties
*
src
,
WpProperties
*
dst
,
const
gchar
*
key1
,
...)
{
gint
ret
;
va_list
args
;
va_start
(
args
,
key1
);
ret
=
wp_properties_copy_keys_valist
(
src
,
dst
,
key1
,
args
);
va_end
(
args
);
return
ret
;
}
gint
wp_properties_copy_keys_valist
(
WpProperties
*
src
,
WpProperties
*
dst
,
const
gchar
*
key1
,
va_list
args
)
{
gint
changed
=
0
;
const
gchar
*
value
;
for
(;
key1
;
key1
=
va_arg
(
args
,
const
gchar
*
))
{
if
((
value
=
wp_properties_get
(
src
,
key1
))
!=
NULL
)
changed
+=
wp_properties_set
(
dst
,
key1
,
value
);
}
return
changed
;
}
const
gchar
*
wp_properties_get
(
WpProperties
*
self
,
const
gchar
*
key
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/wp/properties.h
+
5
−
0
View file @
0c6ef834
...
...
@@ -41,6 +41,11 @@ void wp_properties_unref (WpProperties * self);
gint
wp_properties_update_from_dict
(
WpProperties
*
self
,
const
struct
spa_dict
*
dict
);
gint
wp_properties_copy_keys
(
WpProperties
*
src
,
WpProperties
*
dst
,
const
gchar
*
key1
,
...)
G_GNUC_NULL_TERMINATED
;
gint
wp_properties_copy_keys_valist
(
WpProperties
*
src
,
WpProperties
*
dst
,
const
gchar
*
key1
,
va_list
args
);
const
gchar
*
wp_properties_get
(
WpProperties
*
self
,
const
gchar
*
key
);
gint
wp_properties_set
(
WpProperties
*
self
,
const
gchar
*
key
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment