diff options
| author | Jon Ashburn <jon@lunarg.com> | 2015-08-28 13:38:21 -0600 |
|---|---|---|
| committer | Jon Ashburn <jon@lunarg.com> | 2015-09-04 15:46:31 -0600 |
| commit | 94be72c20be1cfd4ea8b8f6c27c6bdc75cb2a843 (patch) | |
| tree | e6dfed0c7c9cdc2a72c1200b7264b03726b489ea /loader/debug_report.c | |
| parent | 65a2bcfa67d4ce71f0da622b67a12af80e47914f (diff) | |
| download | usermoji-94be72c20be1cfd4ea8b8f6c27c6bdc75cb2a843.tar.xz | |
loader: Make use of app provided allocation callbacks
Convert all heap allocs/frees to use loader_heap_alloc() or loader_heap_free().
Before CreateInstance this will use malloc/free. At (and after) CreateInstance
alloc callbacks are stored and used for any allocations.
Exceptions are thirdparty code (cJSON and dirent_on_windows) still always use
malloc/free. Plan to address these in later patch if ti makes sense.
Diffstat (limited to 'loader/debug_report.c')
| -rw-r--r-- | loader/debug_report.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/loader/debug_report.c b/loader/debug_report.c index 752ddff8..3342a195 100644 --- a/loader/debug_report.c +++ b/loader/debug_report.c @@ -46,9 +46,10 @@ static const VkExtensionProperties debug_report_extension_info = { }; void debug_report_add_instance_extensions( + const struct loader_instance *inst, struct loader_extension_list *ext_list) { - loader_add_to_ext_list(ext_list, 1, &debug_report_extension_info); + loader_add_to_ext_list(inst, ext_list, 1, &debug_report_extension_info); } void debug_report_create_instance( @@ -72,7 +73,7 @@ static VkResult debug_report_DbgCreateMsgCallback( void* pUserData, VkDbgMsgCallback* pMsgCallback) { - VkLayerDbgFunctionNode *pNewDbgFuncNode = (VkLayerDbgFunctionNode *) malloc(sizeof(VkLayerDbgFunctionNode)); + VkLayerDbgFunctionNode *pNewDbgFuncNode = (VkLayerDbgFunctionNode *) loader_heap_alloc((struct loader_instance *)instance, sizeof(VkLayerDbgFunctionNode), VK_SYSTEM_ALLOC_TYPE_INTERNAL); if (!pNewDbgFuncNode) return VK_ERROR_OUT_OF_HOST_MEMORY; @@ -87,7 +88,7 @@ static VkResult debug_report_DbgCreateMsgCallback( pNewDbgFuncNode->pNext = inst->DbgFunctionHead; inst->DbgFunctionHead = pNewDbgFuncNode; } else { - free(pNewDbgFuncNode); + loader_heap_free((struct loader_instance *) instance, pNewDbgFuncNode); } loader_platform_thread_unlock_mutex(&loader_lock); return result; @@ -109,7 +110,7 @@ static VkResult debug_report_DbgDestroyMsgCallback( pPrev->pNext = pTrav->pNext; if (inst->DbgFunctionHead == pTrav) inst->DbgFunctionHead = pTrav->pNext; - free(pTrav); + loader_heap_free((struct loader_instance *) instance, pTrav); break; } pPrev = pTrav; |
