diff options
| author | Mark Young <marky@lunarg.com> | 2016-09-02 11:45:00 -0600 |
|---|---|---|
| committer | Mark Young <marky@lunarg.com> | 2016-09-02 13:52:11 -0600 |
| commit | 3f8c4ffead8818aeab04360eac630d8e8c5136f2 (patch) | |
| tree | ba99a248a54658a0826d5227d1fe691e2992333d /loader | |
| parent | bf2f64665e61e10875780d8e87c62612f96ccda1 (diff) | |
| download | usermoji-3f8c4ffead8818aeab04360eac630d8e8c5136f2.tar.xz | |
loader: Clean up loader_init_generic_list
Modify loader_init_generic_list so that it returns with count
and capacity of 0 if an error occurs.
Change-Id: I916f0dc0bf54a7897cf375bec0647f0379db1d0a
Diffstat (limited to 'loader')
| -rw-r--r-- | loader/loader.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/loader/loader.c b/loader/loader.c index 3a4b6d67..825d2b01 100644 --- a/loader/loader.c +++ b/loader/loader.c @@ -858,14 +858,16 @@ VkResult loader_add_device_extensions(const struct loader_instance *inst, VkResult loader_init_generic_list(const struct loader_instance *inst, struct loader_generic_list *list_info, size_t element_size) { - list_info->capacity = 32 * element_size; + size_t capacity = 32 * element_size; + list_info->count = 0; + list_info->capacity = 0; list_info->list = loader_instance_heap_alloc( - inst, list_info->capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); + inst, capacity, VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE); if (list_info->list == NULL) { return VK_ERROR_OUT_OF_HOST_MEMORY; } - memset(list_info->list, 0, list_info->capacity); - list_info->count = 0; + memset(list_info->list, 0, capacity); + list_info->capacity = capacity; return VK_SUCCESS; } |
