paysages3d/src/system/Memory.cpp
Michaël Lemaire 6166031c8b Speeded up compile time
Reworked *_global.h heavy inclusions
2015-11-18 19:37:00 +01:00

21 lines
576 B
C++

#include "Memory.h"
#include <string>
#include <cstring>
#include <cassert>
void *Memory::naiveArrayInsert(void **array, unsigned long item_size, int item_count, int location) {
char **barray = (char **)array;
assert(location >= 0);
assert(location <= item_count);
*barray = (char *)realloc(*barray, item_size * (item_count + 1));
if (location < item_count) {
memmove(*barray + item_size * (location + 1), *barray + item_size * location,
item_size * (item_count - location));
}
return *barray + item_size * location;
}