5 void ogg_malloc_init(void)
7 mallocbuf
= ci
->codec_get_buffer(&bufsize
);
8 tmp_ptr
= bufsize
& ~3;
12 void *ogg_malloc(size_t size
)
16 size
= (size
+ 3) & ~3;
18 if (mem_ptr
+ size
> tmp_ptr
)
21 x
= &mallocbuf
[mem_ptr
];
22 mem_ptr
+= size
; /* Keep memory 32-bit aligned */
27 void *ogg_tmpmalloc(size_t size
)
29 size
= (size
+ 3) & ~3;
31 if (mem_ptr
+ size
> tmp_ptr
)
35 return &mallocbuf
[tmp_ptr
];
38 void *ogg_calloc(size_t nmemb
, size_t size
)
41 x
= ogg_malloc(nmemb
* size
);
44 ci
->memset(x
, 0, nmemb
* size
);
48 void *ogg_tmpcalloc(size_t nmemb
, size_t size
)
51 x
= ogg_tmpmalloc(nmemb
* size
);
54 ci
->memset(x
, 0, nmemb
* size
);
58 void *ogg_realloc(void *ptr
, size_t size
)
66 long ogg_tmpmalloc_pos(void)
71 void ogg_tmpmalloc_free(long pos
)