More movements of spandsp to the sue of custom allocation routines

This commit is contained in:
Steve Underwood
2013-08-06 01:10:48 +08:00
parent d5e4089c22
commit 799402dd5b
21 changed files with 109 additions and 86 deletions

View File

@@ -76,6 +76,7 @@
#include <tiffio.h>
#include "spandsp/telephony.h"
#include "spandsp/alloc.h"
#include "spandsp/logging.h"
#include "spandsp/bit_operations.h"
#include "spandsp/async.h"
@@ -373,17 +374,17 @@ static int free_buffers(t4_t6_encode_state_t *s)
{
if (s->cur_runs)
{
free(s->cur_runs);
span_free(s->cur_runs);
s->cur_runs = NULL;
}
if (s->ref_runs)
{
free(s->ref_runs);
span_free(s->ref_runs);
s->ref_runs = NULL;
}
if (s->bitstream)
{
free(s->bitstream);
span_free(s->bitstream);
s->bitstream = NULL;
}
s->bytes_per_row = 0;
@@ -1026,13 +1027,13 @@ SPAN_DECLARE(int) t4_t6_encode_set_image_width(t4_t6_encode_state_t *s, int imag
s->bytes_per_row = (s->image_width + 7)/8;
run_space = (s->image_width + 4)*sizeof(uint32_t);
if ((bufptr = (uint32_t *) realloc(s->cur_runs, run_space)) == NULL)
if ((bufptr = (uint32_t *) span_realloc(s->cur_runs, run_space)) == NULL)
return -1;
s->cur_runs = bufptr;
if ((bufptr = (uint32_t *) realloc(s->ref_runs, run_space)) == NULL)
if ((bufptr = (uint32_t *) span_realloc(s->ref_runs, run_space)) == NULL)
return -1;
s->ref_runs = bufptr;
if ((bufptr8 = (uint8_t *) realloc(s->bitstream, (s->image_width + 1)*sizeof(uint16_t))) == NULL)
if ((bufptr8 = (uint8_t *) span_realloc(s->bitstream, (s->image_width + 1)*sizeof(uint16_t))) == NULL)
return -1;
s->bitstream = bufptr8;
}
@@ -1151,7 +1152,7 @@ SPAN_DECLARE(t4_t6_encode_state_t *) t4_t6_encode_init(t4_t6_encode_state_t *s,
{
if (s == NULL)
{
if ((s = (t4_t6_encode_state_t *) malloc(sizeof(*s))) == NULL)
if ((s = (t4_t6_encode_state_t *) span_alloc(sizeof(*s))) == NULL)
return NULL;
}
memset(s, 0, sizeof(*s));
@@ -1181,7 +1182,7 @@ SPAN_DECLARE(int) t4_t6_encode_free(t4_t6_encode_state_t *s)
int ret;
ret = t4_t6_encode_release(s);
free(s);
span_free(s);
return ret;
}
/*- End of function --------------------------------------------------------*/