diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-02-15 02:44:20 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2016-02-15 02:44:20 +0100 |
commit | 22f1fce330059ef8a383cf327a023d6a9da5ad3e (patch) | |
tree | 6893f158dcaaaa1b9f1317923c32a841ba31f768 /libtoolame-dab/mem.c | |
parent | 891bb2592944aa2be2d81e1583e73e632e70537f (diff) | |
download | fdk-aac-22f1fce330059ef8a383cf327a023d6a9da5ad3e.tar.gz fdk-aac-22f1fce330059ef8a383cf327a023d6a9da5ad3e.tar.bz2 fdk-aac-22f1fce330059ef8a383cf327a023d6a9da5ad3e.zip |
Include toolame-dab as library
Diffstat (limited to 'libtoolame-dab/mem.c')
-rw-r--r-- | libtoolame-dab/mem.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/libtoolame-dab/mem.c b/libtoolame-dab/mem.c new file mode 100644 index 0000000..216ec2b --- /dev/null +++ b/libtoolame-dab/mem.c @@ -0,0 +1,44 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include "common.h" +#include "mem.h" + +/******************************************************************************* +* +* Allocate number of bytes of memory equal to "block". +* +*******************************************************************************/ + +void *mem_alloc (unsigned long block, char *item) +{ + + void *ptr; + + ptr = (void *) malloc (block); + + if (ptr != NULL) { + memset (ptr, 0, block); + } else { + fprintf (stderr, "Unable to allocate %s\n", item); + exit (0); + } + return (ptr); +} + + +/**************************************************************************** +* +* Free memory pointed to by "*ptr_addr". +* +*****************************************************************************/ + +void mem_free (void **ptr_addr) +{ + + if (*ptr_addr != NULL) { + free (*ptr_addr); + *ptr_addr = NULL; + } + +} |