Util: Use anonymousMemoryMap for RingFIFO memory

This commit is contained in:
Jeffrey Pfau 2015-09-04 01:48:52 -07:00
parent 5bed376e5c
commit c14da05d8d
1 changed files with 2 additions and 2 deletions

View File

@ -6,14 +6,14 @@
#include "ring-fifo.h" #include "ring-fifo.h"
void RingFIFOInit(struct RingFIFO* buffer, size_t capacity, size_t maxalloc) { void RingFIFOInit(struct RingFIFO* buffer, size_t capacity, size_t maxalloc) {
buffer->data = malloc(capacity); buffer->data = anonymousMemoryMap(capacity);
buffer->capacity = capacity; buffer->capacity = capacity;
buffer->maxalloc = maxalloc; buffer->maxalloc = maxalloc;
RingFIFOClear(buffer); RingFIFOClear(buffer);
} }
void RingFIFODeinit(struct RingFIFO* buffer) { void RingFIFODeinit(struct RingFIFO* buffer) {
free(buffer->data); memoryMapFree(buffer->data, buffer->capacity);
buffer->data = 0; buffer->data = 0;
} }