X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Findex-allocator.cpp;h=32778cd205eae16652af36770d768769db62724f;hb=139a8d250fb18f8ffc95b0936f7285f7b484b72f;hp=7fe18eb1862cd41674b38c359d425de62f1365ad;hpb=c9e313bc594f40a86eed237dce222c0fc99c957f;p=lttng-tools.git diff --git a/src/common/index-allocator.cpp b/src/common/index-allocator.cpp index 7fe18eb18..32778cd20 100644 --- a/src/common/index-allocator.cpp +++ b/src/common/index-allocator.cpp @@ -22,17 +22,19 @@ struct lttng_index_allocator { uint64_t nb_allocated_indexes; }; +namespace { struct lttng_index { uint64_t index; struct cds_list_head head; }; +} /* namespace */ struct lttng_index_allocator *lttng_index_allocator_create( uint64_t index_count) { struct lttng_index_allocator *allocator = NULL; - allocator = (lttng_index_allocator *) zmalloc(sizeof(*allocator)); + allocator = zmalloc(); if (!allocator) { PERROR("Failed to allocate index allocator"); goto end; @@ -92,7 +94,7 @@ enum lttng_index_allocator_status lttng_index_allocator_release( LTTNG_ASSERT(idx < allocator->size); - index = (lttng_index *) zmalloc(sizeof(*index)); + index = zmalloc(); if (!index) { PERROR("Failed to allocate free index queue"); status = LTTNG_INDEX_ALLOCATOR_STATUS_ERROR;