mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-07 13:30:03 -05:00
Use pa_hashmap_remove_and_free() where appropriate
This commit is contained in:
parent
14e2553185
commit
eca082a93f
14 changed files with 29 additions and 84 deletions
|
|
@ -129,16 +129,10 @@ const char *pa_headerlist_gets(pa_headerlist *p, const char *key) {
|
|||
}
|
||||
|
||||
int pa_headerlist_remove(pa_headerlist *p, const char *key) {
|
||||
struct header *hdr;
|
||||
|
||||
pa_assert(p);
|
||||
pa_assert(key);
|
||||
|
||||
if (!(hdr = pa_hashmap_remove(MAKE_HASHMAP(p), key)))
|
||||
return -1;
|
||||
|
||||
header_free(hdr);
|
||||
return 0;
|
||||
return pa_hashmap_remove_and_free(MAKE_HASHMAP(p), key);
|
||||
}
|
||||
|
||||
const char *pa_headerlist_iterate(pa_headerlist *p, void **state) {
|
||||
|
|
|
|||
|
|
@ -190,8 +190,7 @@ static void sink_input_kill(pa_sink_input* i) {
|
|||
pa_sink_input_assert_ref(i);
|
||||
pa_assert_se(s = i->userdata);
|
||||
|
||||
pa_hashmap_remove(s->userdata->by_origin, s->sdp_info.origin);
|
||||
session_free(s);
|
||||
pa_hashmap_remove_and_free(s->userdata->by_origin, s->sdp_info.origin);
|
||||
}
|
||||
|
||||
/* Called from IO context */
|
||||
|
|
@ -647,10 +646,7 @@ static void sap_event_cb(pa_mainloop_api *m, pa_io_event *e, int fd, pa_io_event
|
|||
return;
|
||||
|
||||
if (goodbye) {
|
||||
|
||||
if ((s = pa_hashmap_remove(u->by_origin, info.origin)))
|
||||
session_free(s);
|
||||
|
||||
pa_hashmap_remove_and_free(u->by_origin, info.origin);
|
||||
pa_sdp_info_destroy(&info);
|
||||
} else {
|
||||
|
||||
|
|
@ -687,10 +683,8 @@ static void check_death_event_cb(pa_mainloop_api *m, pa_time_event *t, const str
|
|||
|
||||
k = pa_atomic_load(&s->timestamp);
|
||||
|
||||
if (k + DEATH_TIMEOUT < now.tv_sec) {
|
||||
pa_hashmap_remove(u->by_origin, s->sdp_info.origin);
|
||||
session_free(s);
|
||||
}
|
||||
if (k + DEATH_TIMEOUT < now.tv_sec)
|
||||
pa_hashmap_remove_and_free(u->by_origin, s->sdp_info.origin);
|
||||
}
|
||||
|
||||
/* Restart timer */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue