From 46091a9237f17f4295dca7140d8d70b4fce8b357 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 4 Aug 2004 16:39:30 +0000 Subject: introduce pa_xmalloc() and friends implement module auto loading git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@103 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/pdispatch.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'polyp/pdispatch.c') diff --git a/polyp/pdispatch.c b/polyp/pdispatch.c index 2ab98b52..c34c6e0a 100644 --- a/polyp/pdispatch.c +++ b/polyp/pdispatch.c @@ -29,6 +29,7 @@ #include "pdispatch.h" #include "native-common.h" +#include "xmalloc.h" /*#define DEBUG_OPCODES*/ @@ -96,7 +97,7 @@ static void reply_info_free(struct reply_info *r) { if (r->next) r->next->previous = r->previous; - free(r); + pa_xfree(r); } struct pa_pdispatch* pa_pdispatch_new(struct pa_mainloop_api *mainloop, const struct pa_pdispatch_command*table, unsigned entries) { @@ -105,8 +106,7 @@ struct pa_pdispatch* pa_pdispatch_new(struct pa_mainloop_api *mainloop, const st assert((entries && table) || (!entries && !table)); - pd = malloc(sizeof(struct pa_pdispatch)); - assert(pd); + pd = pa_xmalloc(sizeof(struct pa_pdispatch)); pd->mainloop = mainloop; pd->command_table = table; pd->n_commands = entries; @@ -129,7 +129,7 @@ void pa_pdispatch_free(struct pa_pdispatch *pd) { while (pd->replies) reply_info_free(pd->replies); - free(pd); + pa_xfree(pd); } int pa_pdispatch_run(struct pa_pdispatch *pd, struct pa_packet*packet, void *userdata) { @@ -207,8 +207,7 @@ void pa_pdispatch_register_reply(struct pa_pdispatch *pd, uint32_t tag, int time struct timeval tv; assert(pd && cb); - r = malloc(sizeof(struct reply_info)); - assert(r); + r = pa_xmalloc(sizeof(struct reply_info)); r->pdispatch = pd; r->callback = cb; r->userdata = userdata; -- cgit