mirror of
https://github.com/signalwire/freeswitch.git
synced 2026-11-17 14:58:34 +00:00
Added custom allocation functions to spandsp
This commit is contained in:
1 parent
95ae3732a8
commit
7c744ce1d8
8 files changed
+292
-3
No files matched your search
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* SpanDSP - a series of DSP components for telephony
|
||||
*
|
||||
* alloc_tests.c - memory allocation handling tests.
|
||||
*
|
||||
* Written by Steve Underwood <steveu@coppice.org>
|
||||
*
|
||||
* Copyright (C) 2013 Steve Underwood
|
||||
*
|
||||
* All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2, as
|
||||
* published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*! \file */
|
||||
|
||||
/*! \page alloc_tests_page Memory allocation tests
|
||||
\section alloc_tests_page_sec_1 What does it do?
|
||||
???.
|
||||
|
||||
\section alloc_tests_page_sec_2 How does it work?
|
||||
???.
|
||||
*/
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <limits.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdlib.h>
|
||||
#include <malloc.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "spandsp.h"
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
void *a;
|
||||
void *b;
|
||||
void *c;
|
||||
|
||||
if (span_mem_allocators(malloc,
|
||||
memalign,
|
||||
realloc,
|
||||
free))
|
||||
{
|
||||
printf("Failed\n");
|
||||
exit(2);
|
||||
}
|
||||
a = span_alloc(42);
|
||||
b = span_aligned_alloc(8, 42);
|
||||
c = span_realloc(NULL, 42);
|
||||
printf("%p %p %p\n", a, b, c);
|
||||
span_free(a);
|
||||
span_free(b);
|
||||
span_free(c);
|
||||
}
|
||||
/*- End of function --------------------------------------------------------*/
|
||||
/*- End of file ------------------------------------------------------------*/
|
||||
Reference in new issue
Block a user