aboutsummaryrefslogtreecommitdiff
path: root/dep/recastnavigation/Recast/Source/RecastAlloc.cpp
diff options
context:
space:
mode:
authorjackpoz <giacomopoz@gmail.com>2016-08-17 12:50:43 +0200
committerjoschiwald <joschiwald.trinity@gmail.com>2017-02-12 15:41:19 +0100
commite5ba8f1e4d771a0921b1be0dc1e66a2263b26a44 (patch)
tree296d92398e9f0f2bf4d9ba87dd84e20b7a7a2b07 /dep/recastnavigation/Recast/Source/RecastAlloc.cpp
parenta2acd445fe738ba4b4c8283d13ec8b6029ec9037 (diff)
Core/MMAPs: Update recast
Update recast to https://github.com/recastnavigation/recastnavigation/commit/64385e9ed0822427bca5814d03a3f4c4d7a6db9f (cherry picked from commit 1d7013e0e2758b1468a488dd17e3f5c5ce5f265d) # Conflicts: # dep/PackageList.txt
Diffstat (limited to 'dep/recastnavigation/Recast/Source/RecastAlloc.cpp')
-rw-r--r--dep/recastnavigation/Recast/Source/RecastAlloc.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/dep/recastnavigation/Recast/Source/RecastAlloc.cpp b/dep/recastnavigation/Recast/Source/RecastAlloc.cpp
index b5ec1516146..453b5fa6a60 100644
--- a/dep/recastnavigation/Recast/Source/RecastAlloc.cpp
+++ b/dep/recastnavigation/Recast/Source/RecastAlloc.cpp
@@ -19,8 +19,9 @@
#include <stdlib.h>
#include <string.h>
#include "RecastAlloc.h"
+#include "RecastAssert.h"
-static void *rcAllocDefault(int size, rcAllocHint)
+static void *rcAllocDefault(size_t size, rcAllocHint)
{
return malloc(size);
}
@@ -41,7 +42,7 @@ void rcAllocSetCustom(rcAllocFunc *allocFunc, rcFreeFunc *freeFunc)
}
/// @see rcAllocSetCustom
-void* rcAlloc(int size, rcAllocHint hint)
+void* rcAlloc(size_t size, rcAllocHint hint)
{
return sRecastAllocFunc(size, hint);
}
@@ -72,17 +73,14 @@ void rcFree(void* ptr)
/// Using this method ensures the array is at least large enough to hold
/// the specified number of elements. This can improve performance by
/// avoiding auto-resizing during use.
-void rcIntArray::resize(int n)
+void rcIntArray::doResize(int n)
{
- if (n > m_cap)
- {
- if (!m_cap) m_cap = n;
- while (m_cap < n) m_cap *= 2;
- int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP);
- if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int));
- rcFree(m_data);
- m_data = newData;
- }
- m_size = n;
+ if (!m_cap) m_cap = n;
+ while (m_cap < n) m_cap *= 2;
+ int* newData = (int*)rcAlloc(m_cap*sizeof(int), RC_ALLOC_TEMP);
+ rcAssert(newData);
+ if (m_size && newData) memcpy(newData, m_data, m_size*sizeof(int));
+ rcFree(m_data);
+ m_data = newData;
}