[pulseaudio-commits] 2 commits - src/pulse

Tanu Kaskinen tanuk at kemper.freedesktop.org
Thu Mar 8 23:21:16 PST 2012


 src/pulse/proplist.c |   16 +++++++++-------
 src/pulse/proplist.h |    4 ++--
 2 files changed, 11 insertions(+), 9 deletions(-)

New commits:
commit d6755696b4b2e95d8239d8d7e01333529863484d
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Fri Mar 9 09:20:16 2012 +0200

    proplist: Match pa_proplist_copy argument name between header and implementation.

diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c
index efed17a..649138c 100644
--- a/src/pulse/proplist.c
+++ b/src/pulse/proplist.c
@@ -660,15 +660,15 @@ void pa_proplist_clear(pa_proplist *p) {
         property_free(prop);
 }
 
-pa_proplist* pa_proplist_copy(const pa_proplist *template) {
-    pa_proplist *p;
+pa_proplist* pa_proplist_copy(const pa_proplist *p) {
+    pa_proplist *copy;
 
-    pa_assert_se(p = pa_proplist_new());
+    pa_assert_se(copy = pa_proplist_new());
 
-    if (template)
-        pa_proplist_update(p, PA_UPDATE_REPLACE, template);
+    if (p)
+        pa_proplist_update(copy, PA_UPDATE_REPLACE, p);
 
-    return p;
+    return copy;
 }
 
 unsigned pa_proplist_size(pa_proplist *p) {

commit 6f9e651e4e993ee95c4826fbee36b4d49d592151
Author: Tanu Kaskinen <tanuk at iki.fi>
Date:   Fri Mar 9 08:46:34 2012 +0200

    proplist: Constify the pa_proplist_copy and _update input pointers.

diff --git a/src/pulse/proplist.c b/src/pulse/proplist.c
index 75445e0..efed17a 100644
--- a/src/pulse/proplist.c
+++ b/src/pulse/proplist.c
@@ -321,7 +321,7 @@ int pa_proplist_get(pa_proplist *p, const char *key, const void **data, size_t *
     return 0;
 }
 
-void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, pa_proplist *other) {
+void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, const pa_proplist *other) {
     struct property *prop;
     void *state = NULL;
 
@@ -332,6 +332,8 @@ void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, pa_proplist *othe
     if (mode == PA_UPDATE_SET)
         pa_proplist_clear(p);
 
+    /* MAKE_HASHMAP turns the const pointer into a non-const pointer, but
+     * that's ok, because we don't modify the hashmap contents. */
     while ((prop = pa_hashmap_iterate(MAKE_HASHMAP(other), &state, NULL))) {
 
         if (mode == PA_UPDATE_MERGE && pa_proplist_contains(p, prop->key))
@@ -658,7 +660,7 @@ void pa_proplist_clear(pa_proplist *p) {
         property_free(prop);
 }
 
-pa_proplist* pa_proplist_copy(pa_proplist *template) {
+pa_proplist* pa_proplist_copy(const pa_proplist *template) {
     pa_proplist *p;
 
     pa_assert_se(p = pa_proplist_new());
diff --git a/src/pulse/proplist.h b/src/pulse/proplist.h
index 5802394..f37e5ea 100644
--- a/src/pulse/proplist.h
+++ b/src/pulse/proplist.h
@@ -343,7 +343,7 @@ typedef enum pa_update_mode {
 
 /** Merge property list "other" into "p", adhering the merge mode as
  * specified in "mode". \since 0.9.11 */
-void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, pa_proplist *other);
+void pa_proplist_update(pa_proplist *p, pa_update_mode_t mode, const pa_proplist *other);
 
 /** Removes a single entry from the property list, identified be the
  * specified key name. \since 0.9.11 */
@@ -391,7 +391,7 @@ void pa_proplist_clear(pa_proplist *p);
 
 /** Allocate a new property list and copy over every single entry from
  * the specific list. \since 0.9.11 */
-pa_proplist* pa_proplist_copy(pa_proplist *p);
+pa_proplist* pa_proplist_copy(const pa_proplist *p);
 
 /** Return the number of entries in the property list. \since 0.9.15 */
 unsigned pa_proplist_size(pa_proplist *p);



More information about the pulseaudio-commits mailing list