Commit graph

7 commits

Author SHA1 Message Date
Barnabás Pőcze
a6151e96cd pipewire: properties: introduce pw_properties_{steal,gift}
Add functions

  pw_properties_steal(properties, key);
  pw_properties_gift(properties, key, value);

which can be used to retrieve/insert key-value pairs from/into
a property list without creating unnecessary copies of the value.

Add tests as well.
2021-06-21 12:55:58 +02:00
Barnabás Pőcze
be18d052ad pipewire: properties: introduce pw_properties_move
Add

  pw_properties_move(dst, dst_key, src, src_key, fallback_value)

which can move a key-value pair from one property list into
another, optionally using the fallback value as value if
`src_key` cannot be found in `src`.

Add tests as well.

This commit also adds `pw_properties_rename()`, which can be used
to change the key in a dictionary, but that is not made part of
the public API yet.
2021-06-21 12:49:02 +02:00
Peter Hutterer
62e98aa836 test: move some of the property tests to pwtest
Mostly 1:1 move of the test-properties.c file in src to the one in test, but a
few checks were merged into the existing functions.
2021-06-17 07:08:53 +00:00
Peter Hutterer
da339c286f meson.build: drop HAVE_CONFIG_H
This is an autotools leftover, with meson we're always guaranteed to have
the config.h file.
2021-06-10 09:04:16 +10:00
Wim Taymans
667fa18526 test: fix property test
The long key is now ignored instead of truncated.
2021-06-09 18:17:31 +02:00
Peter Hutterer
008195924c test: add a test for the properties stack overflow
See #1249
2021-06-09 18:00:58 +10:00
Peter Hutterer
44dcca0d99 test: add tests for pw_properties 2021-06-09 18:00:37 +10:00