aboutsummaryrefslogtreecommitdiffstats
path: root/router/router.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2017-07-01 12:22:25 -0700
committerChris Robinson <[email protected]>2017-07-01 12:22:25 -0700
commit7daefd4e77cb7d61fd386691a0a53643c0db0533 (patch)
treec4be2cda6038dcea1c313aa21742750301afeed9 /router/router.c
parent32bda7b94c95f4f83a5c329c415d4dc14e099c03 (diff)
Use the al alloc functions instead of standard
Diffstat (limited to 'router/router.c')
-rw-r--r--router/router.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/router/router.c b/router/router.c
index 9522814d..53229aca 100644
--- a/router/router.c
+++ b/router/router.c
@@ -9,6 +9,7 @@
#include "AL/alc.h"
#include "AL/al.h"
+#include "almalloc.h"
DriverIface *DriverList = NULL;
@@ -73,7 +74,7 @@ BOOL APIENTRY DllMain(HINSTANCE UNUSED(module), DWORD reason, void* UNUSED(reser
if(DriverList[i].Module)
FreeLibrary(DriverList[i].Module);
}
- free(DriverList);
+ al_free(DriverList);
DriverList = NULL;
DriverListSize = 0;
DriverListSizeMax = 0;
@@ -118,11 +119,11 @@ static void AddModule(HMODULE module, const WCHAR *name)
if(DriverListSize == DriverListSizeMax)
{
int newmax = DriverListSizeMax ? DriverListSizeMax<<1 : 4;
- void *newlist = calloc(sizeof(DriverList[0]), newmax);
+ void *newlist = al_calloc(DEF_ALIGN, sizeof(DriverList[0])*newmax);
if(!newlist) return;
memcpy(newlist, DriverList, DriverListSize*sizeof(DriverList[0]));
- free(DriverList);
+ al_free(DriverList);
DriverList = newlist;
DriverListSizeMax = newmax;
}
@@ -351,7 +352,7 @@ void InitPtrIntMap(PtrIntMap *map)
void ResetPtrIntMap(PtrIntMap *map)
{
WriteLock(&map->lock);
- free(map->keys);
+ al_free(map->keys);
map->keys = NULL;
map->values = NULL;
map->size = 0;
@@ -390,7 +391,7 @@ ALenum InsertPtrIntMapEntry(PtrIntMap *map, ALvoid *key, ALint value)
newcap = (map->capacity ? (map->capacity<<1) : 4);
if(newcap > map->capacity)
- keys = calloc(sizeof(map->keys[0])+sizeof(map->values[0]), newcap);
+ keys = al_calloc(16, (sizeof(map->keys[0])+sizeof(map->values[0]))*newcap);
if(!keys)
{
WriteUnlock(&map->lock);
@@ -403,7 +404,7 @@ ALenum InsertPtrIntMapEntry(PtrIntMap *map, ALvoid *key, ALint value)
memcpy(keys, map->keys, map->size*sizeof(map->keys[0]));
memcpy(values, map->values, map->size*sizeof(map->values[0]));
}
- free(map->keys);
+ al_free(map->keys);
map->keys = keys;
map->values = values;
map->capacity = newcap;