Fix: sessiond: instance uuid is not sufficiently unique
[lttng-tools.git] / src / common / index-allocator.cpp
index c48d708d0ea2759e8806aa5558d949ae2ec12e8d..32778cd205eae16652af36770d768769db62724f 100644 (file)
 #include <urcu.h>
 #include <urcu/list.h>
 
-#include "macros.h"
-#include "error.h"
+#include "macros.hpp"
+#include "error.hpp"
 
-#include "index-allocator.h"
+#include "index-allocator.hpp"
 
 struct lttng_index_allocator {
        struct cds_list_head unused_list;
@@ -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<lttng_index_allocator>();
        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<lttng_index>();
        if (!index) {
                PERROR("Failed to allocate free index queue");
                status = LTTNG_INDEX_ALLOCATOR_STATUS_ERROR;
This page took 0.023844 seconds and 4 git commands to generate.