diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-10-14 02:22:51 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-10-14 06:06:49 +0300 |
commit | 5401fda41244175b491ab5aad8c9693b3eb09f33 (patch) | |
tree | e21c91d18495431da34ab53779ed3f385bb2348a /source/blender/blenkernel/intern/subdiv_ccg.c | |
parent | 576142dc85c78ced792e3440a7665ea57e45a0cc (diff) |
Cleanup: avoid using size for array length in naming
Confusing when array allocation takes two kinds of size arguments.
Diffstat (limited to 'source/blender/blenkernel/intern/subdiv_ccg.c')
-rw-r--r-- | source/blender/blenkernel/intern/subdiv_ccg.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/subdiv_ccg.c b/source/blender/blenkernel/intern/subdiv_ccg.c index c7c77b83e25..77962ec924c 100644 --- a/source/blender/blenkernel/intern/subdiv_ccg.c +++ b/source/blender/blenkernel/intern/subdiv_ccg.c @@ -359,30 +359,29 @@ static void subdiv_ccg_init_faces(SubdivCCG *subdiv_ccg) /* TODO(sergey): Consider making it generic enough to be fit into BLI. */ typedef struct StaticOrHeapIntStorage { int static_storage[64]; - int static_storage_size; + int static_storage_len; int *heap_storage; - int heap_storage_size; + int heap_storage_len; } StaticOrHeapIntStorage; static void static_or_heap_storage_init(StaticOrHeapIntStorage *storage) { - storage->static_storage_size = sizeof(storage->static_storage) / - sizeof(*storage->static_storage); + storage->static_storage_len = sizeof(storage->static_storage) / sizeof(*storage->static_storage); storage->heap_storage = NULL; - storage->heap_storage_size = 0; + storage->heap_storage_len = 0; } -static int *static_or_heap_storage_get(StaticOrHeapIntStorage *storage, int size) +static int *static_or_heap_storage_get(StaticOrHeapIntStorage *storage, int heap_len) { /* Requested size small enough to be fit into stack allocated memory. */ - if (size <= storage->static_storage_size) { + if (heap_len <= storage->static_storage_len) { return storage->static_storage; } /* Make sure heap ius big enough. */ - if (size > storage->heap_storage_size) { + if (heap_len > storage->heap_storage_len) { MEM_SAFE_FREE(storage->heap_storage); - storage->heap_storage = MEM_malloc_arrayN(size, sizeof(int), "int storage"); - storage->heap_storage_size = size; + storage->heap_storage = MEM_malloc_arrayN(heap_len, sizeof(int), "int storage"); + storage->heap_storage_len = heap_len; } return storage->heap_storage; } |