Moved a lot of spandsp to the use of custom allocation functions

This commit is contained in:
Steve Underwood committed 2013-08-06 00:49:15 +08:00
1 parent 7c744ce1d8
commit d5e4089c22
46 files changed
+233 -187

No files matched your search

+7 -6
View File
@@ -41,6 +41,7 @@
#include <limits.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/playout.h"
static playout_frame_t *queue_get(playout_state_t *s, timestamp_t sender_stamp)
@@ -236,7 +237,7 @@ SPAN_DECLARE(int) playout_put(playout_state_t *s, void *data, int type, timestam
}
else
{
if ((frame = (playout_frame_t *) malloc(sizeof(*frame))) == NULL)
if ((frame = (playout_frame_t *) span_alloc(sizeof(*frame))) == NULL)
return PLAYOUT_ERROR;
}
@@ -312,7 +313,7 @@ SPAN_DECLARE(void) playout_restart(playout_state_t *s, int min_length, int max_l
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
memset(s, 0, sizeof(*s));
@@ -332,7 +333,7 @@ SPAN_DECLARE(playout_state_t *) playout_init(int min_length, int max_length)
{
playout_state_t *s;
if ((s = (playout_state_t *) malloc(sizeof(playout_state_t))) == NULL)
if ((s = (playout_state_t *) span_alloc(sizeof(playout_state_t))) == NULL)
return NULL;
memset(s, 0, sizeof(*s));
playout_restart(s, min_length, max_length);
@@ -350,13 +351,13 @@ SPAN_DECLARE(int) playout_release(playout_state_t *s)
for (frame = s->first_frame; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
/* Free all the frames on the free list */
for (frame = s->free_frames; frame; frame = next)
{
next = frame->later;
free(frame);
span_free(frame);
}
return 0;
}
@@ -368,7 +369,7 @@ SPAN_DECLARE(int) playout_free(playout_state_t *s)
{
playout_release(s);
/* Finally, free ourselves! */
free(s);
span_free(s);
}
return 0;
}