summaryrefslogtreecommitdiff
path: root/src/modules/module-device-manager.c
diff options
context:
space:
mode:
authorArun Raghavan <arun.raghavan@collabora.co.uk>2013-09-14 11:50:10 +0530
committerArun Raghavan <arun.raghavan@collabora.co.uk>2013-09-17 18:01:22 +0530
commit6825df8cecb050a42804ad861bf67e8e42f634ea (patch)
tree00fe32603e74ab562898d9c91fd126bb0b61d9e6 /src/modules/module-device-manager.c
parent317b46b57141f81153e3e7a3966cf9fd1119b0b4 (diff)
hashmap: Add the ability to free keys
Since the hashmap stores a pointer to the key provided at pa_hashmap_put() time, it make sense to allow the hashmap to be given ownership of the key and have it free it at pa_hashmap_remove/free time. To do this cleanly, we now provide the key and value free functions at hashmap creation time with a pa_hashmap_new_full. With this, we do away with the free function that was provided at remove/free time for freeing the value.
Diffstat (limited to 'src/modules/module-device-manager.c')
-rw-r--r--src/modules/module-device-manager.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/module-device-manager.c b/src/modules/module-device-manager.c
index 6ae9ceea..9df3d8e2 100644
--- a/src/modules/module-device-manager.c
+++ b/src/modules/module-device-manager.c
@@ -1311,7 +1311,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
pa_xfree(device);
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
pa_log_error("Protocol error on reorder");
goto fail;
}
@@ -1323,7 +1323,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
pa_xfree(device);
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
pa_log_error("Client specified an unknown device in it's reorder list.");
goto fail;
}
@@ -1338,7 +1338,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
pa_xfree(device);
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
pa_log_error("Attempted to reorder mixed devices (sinks and sources)");
goto fail;
}
@@ -1411,7 +1411,7 @@ static int extension_cb(pa_native_protocol *p, pa_module *m, pa_native_connectio
while ((device = pa_hashmap_steal_first(h))) {
devices[idx++] = device;
}
- pa_hashmap_free(h, NULL);
+ pa_hashmap_free(h);
/* Simple bubble sort */
for (i = 0; i < n_devices; ++i) {