diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-08-04 16:39:30 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-08-04 16:39:30 +0000 |
commit | 46091a9237f17f4295dca7140d8d70b4fce8b357 (patch) | |
tree | 1c600cd6e1801586abfb66d767f2cd96e15c819c /polyp/pstream.c | |
parent | 24291aff27c671c11619684cb10d3b36fdf87c0d (diff) |
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
Diffstat (limited to 'polyp/pstream.c')
-rw-r--r-- | polyp/pstream.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/polyp/pstream.c b/polyp/pstream.c index 7d576a16..e7441b24 100644 --- a/polyp/pstream.c +++ b/polyp/pstream.c @@ -30,6 +30,7 @@ #include "pstream.h" #include "queue.h" +#include "xmalloc.h" enum pa_pstream_descriptor_index { PA_PSTREAM_DESCRIPTOR_LENGTH, @@ -148,8 +149,7 @@ struct pa_pstream *pa_pstream_new(struct pa_mainloop_api *m, struct pa_iochannel struct pa_pstream *p; assert(io); - p = malloc(sizeof(struct pa_pstream)); - assert(p); + p = pa_xmalloc(sizeof(struct pa_pstream)); p->io = io; pa_iochannel_set_callback(io, io_callback, p); @@ -199,7 +199,7 @@ static void item_free(void *item, void *p) { pa_packet_unref(i->packet); } - free(i); + pa_xfree(i); } void pa_pstream_free(struct pa_pstream *p) { @@ -224,15 +224,14 @@ void pa_pstream_free(struct pa_pstream *p) { pa_packet_unref(p->read.packet); p->mainloop->cancel_fixed(p->mainloop, p->mainloop_source); - free(p); + pa_xfree(p); } void pa_pstream_send_packet(struct pa_pstream*p, struct pa_packet *packet) { struct item_info *i; assert(p && packet); - i = malloc(sizeof(struct item_info)); - assert(i); + i = pa_xmalloc(sizeof(struct item_info)); i->type = PA_PSTREAM_ITEM_PACKET; i->packet = pa_packet_ref(packet); @@ -244,8 +243,7 @@ void pa_pstream_send_memblock(struct pa_pstream*p, uint32_t channel, int32_t del struct item_info *i; assert(p && channel != (uint32_t) -1 && chunk); - i = malloc(sizeof(struct item_info)); - assert(i); + i = pa_xmalloc(sizeof(struct item_info)); i->type = PA_PSTREAM_ITEM_MEMBLOCK; i->chunk = *chunk; i->channel = channel; |