Doxygen Source Code Documentation
alloc.c File Reference
#include "config.h"#include <stdlib.h>#include <inttypes.h>#include "mpeg2.h"#include "mpeg2_internal.h"Go to the source code of this file.
Functions | |
| void * | mpeg2_malloc (int size, int reason) |
| void | mpeg2_free (void *buf) |
Variables | |
| void *(* | mpeg2_malloc_hook )(int size, int reason)=NULL |
| int(* | mpeg2_free_hook )(void *buf)=NULL |
Function Documentation
|
|
Definition at line 66 of file alloc.c. References free, and mpeg2_free_hook. Referenced by mpeg2_close().
00067 {
00068 if (mpeg2_free_hook && mpeg2_free_hook (buf))
00069 return;
00070
00071 #if defined(HAVE_MEMALIGN) && !defined(__cplusplus) && !defined(DEBUG)
00072 free (buf);
00073 #else
00074 free (*(((void **)buf) - 1));
00075 #endif
00076 }
|
|
||||||||||||
|
Definition at line 40 of file alloc.c. References malloc, memalign(), and mpeg2_malloc_hook. Referenced by mpeg2_convert(), mpeg2_header_picture(), and mpeg2_init().
00041 {
00042 char * buf;
00043
00044 if (mpeg2_malloc_hook) {
00045 buf = (char *) mpeg2_malloc_hook (size, reason);
00046 if (buf)
00047 return buf;
00048 }
00049
00050 #if defined(HAVE_MEMALIGN) && !defined(__cplusplus) && !defined(DEBUG)
00051 return memalign (16, size);
00052 #else
00053 buf = (char *) malloc (size + 15 + sizeof (void **));
00054 if (buf) {
00055 char * align_buf;
00056
00057 align_buf = buf + 15 + sizeof (void **);
00058 align_buf -= (long)align_buf & 15;
00059 *(((void **)align_buf) - 1) = buf;
00060 return align_buf;
00061 }
00062 return NULL;
00063 #endif
00064 }
|
Variable Documentation
|
|
Definition at line 38 of file alloc.c. Referenced by mpeg2_free(). |
|
|
Definition at line 37 of file alloc.c. Referenced by mpeg2_malloc(). |