diff options
Diffstat (limited to 'source/blender/blenlib/intern/array_store.c')
-rw-r--r-- | source/blender/blenlib/intern/array_store.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/source/blender/blenlib/intern/array_store.c b/source/blender/blenlib/intern/array_store.c index 387f9837159..847cb42186a 100644 --- a/source/blender/blenlib/intern/array_store.c +++ b/source/blender/blenlib/intern/array_store.c @@ -112,6 +112,7 @@ /* only for BLI_array_store_is_valid */ #include "BLI_ghash.h" +/* -------------------------------------------------------------------- */ /** \name Defines * * Some of the logic for merging is quite involved, @@ -189,7 +190,7 @@ */ # define BCHUNK_SIZE_MIN_DIV 8 -/* Disallow chunks bigger then the regular chunk size scaled by this value +/* Disallow chunks bigger than the regular chunk size scaled by this value * note: must be at least 2! * however, this code runs wont run in tests unless its ~1.1 ugh. * so lower only to check splitting works. @@ -206,6 +207,7 @@ /** \} */ +/* -------------------------------------------------------------------- */ /** \name Internal Structs * \{ */ @@ -313,6 +315,7 @@ typedef struct BTableRef { static size_t bchunk_list_size(const BChunkList *chunk_list); +/* -------------------------------------------------------------------- */ /** \name Internal BChunk API * \{ */ @@ -360,6 +363,7 @@ static bool bchunk_data_compare(const BChunk *chunk, /** \} */ +/* -------------------------------------------------------------------- */ /** \name Internal BChunkList API * \{ */ @@ -523,7 +527,7 @@ static void bchunk_list_calc_trim_len(const BArrayInfo *info, #ifdef USE_MERGE_CHUNKS /* avoid creating too-small chunks - * more efficient then merging after */ + * more efficient than merging after */ if (data_len > info->chunk_byte_size) { data_last_chunk_len = (data_trim_len % info->chunk_byte_size); data_trim_len = data_trim_len - data_last_chunk_len; @@ -732,10 +736,11 @@ static void bchunk_list_fill_from_array(const BArrayInfo *info, /** \} */ -/* --------------------------------------------------------------------------- +/* * Internal Table Lookup Functions */ +/* -------------------------------------------------------------------- */ /** \name Internal Hashing/De-Duplication API * * Only used by #bchunk_list_from_data_merge @@ -1005,6 +1010,7 @@ static const BChunkRef *table_lookup(const BArrayInfo *info, /** \} */ +/* -------------------------------------------------------------------- */ /** \name Main Data De-Duplication Function * * \{ */ @@ -1307,7 +1313,7 @@ static BChunkList *bchunk_list_from_data_merge(const BArrayInfo *info, ASSERT_CHUNKLIST_DATA(chunk_list, data); /* its likely that the next chunk in the list will be a match, so check it! */ - while ((cref_found->next != NULL) && (cref_found->next != chunk_list_reference_last)) { + while (!ELEM(cref_found->next, NULL, chunk_list_reference_last)) { cref_found = cref_found->next; BChunk *chunk_found = cref_found->link; @@ -1390,6 +1396,7 @@ static BChunkList *bchunk_list_from_data_merge(const BArrayInfo *info, /** \} */ +/* -------------------------------------------------------------------- */ /** \name Main Array Storage API * \{ */ @@ -1405,7 +1412,7 @@ static BChunkList *bchunk_list_from_data_merge(const BArrayInfo *info, * * \param chunk_count: Number of elements to split each chunk into. * - A small value increases the ability to de-duplicate chunks, - * but adds overhead by increasing the number of chunks to look-up when searching for duplicates, + * but adds overhead by increasing the number of chunks to look up when searching for duplicates, * as well as some overhead constructing the original array again, with more calls to ``memcpy``. * - Larger values reduce the *book keeping* overhead, * but increase the chance a small, @@ -1496,6 +1503,7 @@ void BLI_array_store_clear(BArrayStore *bs) /** \} */ +/* -------------------------------------------------------------------- */ /** \name BArrayStore Statistics * \{ */ @@ -1530,6 +1538,7 @@ size_t BLI_array_store_calc_size_compacted_get(const BArrayStore *bs) /** \} */ +/* -------------------------------------------------------------------- */ /** \name BArrayState Access * \{ */ @@ -1653,6 +1662,7 @@ void *BLI_array_store_state_data_get_alloc(BArrayState *state, size_t *r_data_le /** \} */ +/* -------------------------------------------------------------------- */ /** \name Debugging API (for testing). * \{ */ |