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/queue.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/queue.c')
-rw-r--r-- | polyp/queue.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/polyp/queue.c b/polyp/queue.c index 9befd475..9488f433 100644 --- a/polyp/queue.c +++ b/polyp/queue.c @@ -27,6 +27,7 @@ #include <stdlib.h> #include "queue.h" +#include "xmalloc.h" struct queue_entry { struct queue_entry *next; @@ -39,8 +40,7 @@ struct pa_queue { }; struct pa_queue* pa_queue_new(void) { - struct pa_queue *q = malloc(sizeof(struct pa_queue)); - assert(q); + struct pa_queue *q = pa_xmalloc(sizeof(struct pa_queue)); q->front = q->back = NULL; q->length = 0; return q; @@ -57,18 +57,17 @@ void pa_queue_free(struct pa_queue* q, void (*destroy)(void *p, void *userdata), if (destroy) destroy(e->data, userdata); - free(e); + pa_xfree(e); e = n; } - free(q); + pa_xfree(q); } void pa_queue_push(struct pa_queue *q, void *p) { struct queue_entry *e; - e = malloc(sizeof(struct queue_entry)); - + e = pa_xmalloc(sizeof(struct queue_entry)); e->data = p; e->next = NULL; @@ -96,7 +95,7 @@ void* pa_queue_pop(struct pa_queue *q) { q->back = NULL; p = e->data; - free(e); + pa_xfree(e); q->length--; |