diff options
author | Corey Farrell <git@cfware.com> | 2015-05-12 09:58:52 -0400 |
---|---|---|
committer | Corey Farrell <git@cfware.com> | 2015-05-13 21:55:07 -0400 |
commit | 478fb4a388afcb56e7e50184c996f0838d609a66 (patch) | |
tree | 7a09c1698a458a65e6703fcee59f64ec6afeed38 /res/res_fax_spandsp.c | |
parent | 3858e67dd549cf600fe1ed0c814affd9fb64c708 (diff) |
MALLOC_DEBUG: Replace WRAP_LIBC_MALLOC with ASTMM_LIBC.
There are 3 ways that calls directly to standard allocator functions can
be dealt with:
1. Block their use, cause them to generate an error. This is the default.
2. Replace them with the Asterisk equivalent function calls.
3. Leave them alone.
This change allows one of these 3 options to be selected by any source.
The source just needs to define ASTMM_LIBC to ASTMM_BLOCK, ASTMM_REDIRECT,
or ASTMM_IGNORE to use option 1, 2 or 3 respectively. Normally ASTMM_BLOCK
is the correct option, so it is default when ASTMM_LIBC is not defined.
In some cases when building 3rd party code it is desirable to have it use
Asterisk functions, without changing the whole source - ASTMM_REDIRECT
accomplishes this. When using 3rd party libraries sometimes a static
inline function will make use of malloc or free. In these cases it may
be unsafe to replace the allocator in the header, as it's possible the
memory could be freed by the library using standard allocators. For
those cases ASTMM_IGNORE is needed.
Change-Id: I8afef4bc7f3b93914263ae27d3a5858b69663fc7
Diffstat (limited to 'res/res_fax_spandsp.c')
-rw-r--r-- | res/res_fax_spandsp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/res/res_fax_spandsp.c b/res/res_fax_spandsp.c index 42492273d..ddbb17840 100644 --- a/res/res_fax_spandsp.c +++ b/res/res_fax_spandsp.c @@ -48,12 +48,8 @@ <support_level>extended</support_level> ***/ -/* Include spandsp headers before asterisk.h so the inline functions can continue using - * malloc and free, even with MALLOC_DEBUG enabled. */ -#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES -#include <spandsp.h> -#include <spandsp/version.h> - +/* Needed for spandsp headers */ +#define ASTMM_LIBC ASTMM_IGNORE #include "asterisk.h" ASTERISK_REGISTER_FILE() @@ -69,6 +65,10 @@ ASTERISK_REGISTER_FILE() #include "asterisk/channel.h" #include "asterisk/format_cache.h" +#define SPANDSP_EXPOSE_INTERNAL_STRUCTURES +#include <spandsp.h> +#include <spandsp/version.h> + #define SPANDSP_FAX_SAMPLES 160 #define SPANDSP_FAX_TIMER_RATE 8000 / SPANDSP_FAX_SAMPLES /* 50 ticks per second, 20ms, 160 samples per second */ #define SPANDSP_ENGAGE_UDPTL_NAT_RETRY 3 |