Commit graph

35 commits

Author SHA1 Message Date
Tanu Kaskinen
eca082a93f Use pa_hashmap_remove_and_free() where appropriate 2014-04-17 10:06:23 +03:00
Arun Raghavan
6825df8cec 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.
2013-09-17 18:01:22 +05:30
poljar (Damir Jelić)
d806b19714 Remove pa_bool_t and replace it with bool.
commands used for this (executed from the pulseaudio/src directory):
    find . -regex '\(.*\.[hc]\|.*\.cc\|.*\.m4\)' -not -name 'macro.h' \
        -a -not -name 'reserve.[ch]' -a -not -name 'reserve-monitor.[ch]' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'glib-mainloop.c' -a -not -name 'gkt-test.c' \
        -a -not -name 'poll-win32.c' -a -not -name 'thread-win32.c' \
        -a -not -name 'dllmain.c' -a -not -name 'gconf-helper.c' \
        -exec sed -i -e 's/\bpa_bool_t\b/bool/g' \
        -e 's/\bTRUE\b/true/g' -e 's/\bFALSE\b/false/g' {} \;

and:
    sed -i -e '181,194!s/\bpa_bool_t\b/bool/' \
        -e '181,194!s/\bTRUE\b/true/' -e \
        '181,194!s/\bFALSE\b/false/' pulsecore/macro.h
2013-07-04 12:25:30 +03:00
Tanu Kaskinen
2c666e3e16 idxset: Add pa_idxset_remove_all()
Slightly nicer than using pa_idxset_steal_first() in a loop.
2013-02-16 01:18:59 +02:00
Tanu Kaskinen
31ee1a7d54 hashmap: Add pa_hashmap_remove_all()
Slightly nicer than using pa_hashmap_steal_first() in a loop.
2013-02-16 01:17:04 +02:00
Tanu Kaskinen
061878b5a4 idxset: Use pa_free_cb_t instead of pa_free2_cb_t
There were no users for the userdata pointer.
2013-02-16 01:15:27 +02:00
Tanu Kaskinen
8872c238ba hashmap: Use pa_free_cb_t instead of pa_free2_cb_t
The previous patch removed module-gconf's dependency on the userdata
pointer of the free callback, and that was the only place where the
userdata pointer of pa_free2_cb_t was used, so now there's no need for
pa_free2_cb_t in pa_hashmap_free(). Using pa_free_cb_t instead allows
removing a significant amount of repetitive code.
2013-02-16 01:12:21 +02:00
Tanu Kaskinen
4ffb6fd617 dbus: Fix cleanup when removing signal listeners 2013-02-06 12:34:06 +02:00
Tanu Kaskinen
1c134f4517 dbus: Add assertions to get rid of warnings from Coverity.
Coverity thinks that expected_method_sig can be NULL when
it's dereferenced by pa_streq(). Adding assertions doesn't
hurt here (in my opinion), and that should get rid of the
warnings.
2012-03-28 17:34:19 +03:00
Tanu Kaskinen
e9d82afdea dbus: Check method call signatures.
BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=45815
2012-03-25 08:40:56 +03:00
Tanu Kaskinen
66f04c3bdc dbus: Use correct free function. 2012-03-06 08:41:10 +02:00
Maarten Bosmans
c5dca7cf2b More spelling fixes 2011-08-25 11:27:47 +01:00
Maarten Bosmans
b430407f47 Plug some memory leaks and an invalid read
Note in protocol-dbus.c specifically, method_signatures needs to be freed
before method_handlers, because otherwise h->method_name is freed while it is
still in use as a key in the method_signatures hashmap.
2011-08-12 20:31:52 +02:00
Tanu Kaskinen
dcab6e1561 protocol-dbus: Fix some memory management bugs.
There were several memory leaks. In addition to those,
pa_dbus_protocol_add_interface() used a string from the
caller as a key to a hashmap, instead of a copy of the
string. This caused trouble when the caller freed the
string while the key was still in use in the hashmap.
2011-04-23 18:23:38 +01:00
Colin Guthrie
1e381fbffc dbus: Do not refcnt the core.
We should not call pa_core_ref() anywhere in the code. Doing so
will prevent proper daemon shutdown as the only call (in daemon/main.c)
to pa_core_unref() should always call free_core() and perform a normal
shutdown (i.e. unload all modules gracefully).
2011-03-25 23:43:26 +00:00
Tanu Kaskinen
5012dc8450 dbus: Fix slightly messed up assertions. 2010-05-10 14:33:16 +03:00
Tanu Kaskinen
63c24fa49a dbus: Use a struct as the hashmap items for listening_signals.
Previously we used libdbus's memory as keys in listening_signals, which caused
that the memory of the hashmap keys got overwritten, which led to that signals
weren't sent properly.
2010-05-10 14:29:30 +03:00
Tanu Kaskinen
acaeb71cf8 dbus: Fix segfault when receiving a property access call that isn't permitted. 2010-05-10 14:10:09 +03:00
Tanu Kaskinen
e785f728a5 dbus: Add a missing break statement in handle_message_cb(). 2009-12-03 21:50:19 +00:00
Tanu Kaskinen
7b1b68ce2c dbus: Handle the cases when a non-existing interface is detected in an incoming message. 2009-12-03 21:50:19 +00:00
Diego Elio 'Flameeyes' Pettenò
d963998676 Rename all the signal parameters and variables to something more explicit.
Without this change, on FreeBSD you'll be bothered by tons of warnings
about overshadowing signal(2).
2009-11-21 00:46:46 +01:00
Tanu Kaskinen
587131917f dbus-protocol: Implement argument type checking for normal methods. 2009-08-31 18:12:55 +03:00
Tanu Kaskinen
0e096632c5 dbus: Do message argument type checking early, centrally. 2009-08-30 19:52:22 +03:00
Tanu Kaskinen
57886ff34a dbus-protocol: Print a debug line whenever interfaces are unregistered. 2009-08-24 14:26:13 +03:00
Tanu Kaskinen
22ab141450 dbus-protocol: Use pa_hashmap_remove() instead of _get(). 2009-08-15 06:13:17 +03:00
Tanu Kaskinen
31117fe99e dbus-protocol: Fix signal sending for the case when the client doesn't listen
for all signals.
2009-08-10 10:40:40 +03:00
Tanu Kaskinen
16dce8d7cb dbus-protocol: Take advantage of the helpers in dbus-util. 2009-08-09 09:19:33 +03:00
Tanu Kaskinen
7699cfd4c0 dbus-protocol: Split some overly long lines. 2009-08-09 09:18:03 +03:00
Tanu Kaskinen
06232e2965 dbus: Take advantage of the PA_HASHMAP_FOREACH macro. 2009-08-09 09:04:15 +03:00
Tanu Kaskinen
0fc055226c dbus-protocol: Remove erroneous protocol object unref. 2009-08-04 18:00:08 +03:00
Tanu Kaskinen
9eeb8eb272 dbus-protocol: Make debug logging saner. 2009-08-04 17:57:44 +03:00
Tanu Kaskinen
b1578e27b6 dbus-protocol, dbusiface-core: Take a reference when storing the core pointer. 2009-08-04 17:55:10 +03:00
Tanu Kaskinen
8c840572c7 dbus-protocol: Add debugging output (temporary change). 2009-08-02 11:12:21 +03:00
Tanu Kaskinen
c354a08fe3 dbus-protocol: Implement extension registration. 2009-07-31 12:05:49 +03:00
Tanu Kaskinen
9347e90fed Finish the Core dbus interface. 2009-07-21 00:02:27 +03:00