X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Ftrace-chunk.cpp;h=2d12216d0ed7ceee52526a316c8c502a2116c993;hb=64803277bbdbe0a943360d918298a48157d9da55;hp=9e804ce0197b25c74a66a0b211cce3fa8f77768a;hpb=c26d615c0c49dd994a687c8e1afe670809100765;p=lttng-tools.git diff --git a/src/common/trace-chunk.cpp b/src/common/trace-chunk.cpp index 9e804ce01..2d12216d0 100644 --- a/src/common/trace-chunk.cpp +++ b/src/common/trace-chunk.cpp @@ -5,23 +5,23 @@ * */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include @@ -171,7 +171,7 @@ const char *lttng_trace_chunk_command_type_str( }; static -const chunk_command close_command_get_post_release_func( +chunk_command close_command_get_post_release_func( lttng_trace_chunk_command_type type) { switch (type) { case LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED: @@ -203,7 +203,7 @@ struct fs_handle *fs_handle_untracked_create( goto end; } - handle = (fs_handle_untracked *) zmalloc(sizeof(typeof(*handle))); + handle = zmalloc(); if (!handle) { PERROR("Failed to allocate untracked filesystem handle"); goto end; @@ -238,7 +238,7 @@ int fs_handle_untracked_get_fd(struct fs_handle *_handle) } static -void fs_handle_untracked_put_fd(struct fs_handle *_handle) +void fs_handle_untracked_put_fd(struct fs_handle *_handle __attribute__((unused))) { /* no-op. */ } @@ -346,7 +346,7 @@ char *generate_chunk_name(uint64_t chunk_id, time_t creation_timestamp, goto error; } } - new_name = (char *) zmalloc(GENERATED_CHUNK_NAME_LEN); + new_name = calloc(GENERATED_CHUNK_NAME_LEN); if (!new_name) { ERR("Failed to allocate buffer for automatically-generated trace chunk name"); goto error; @@ -399,7 +399,7 @@ struct lttng_trace_chunk *lttng_trace_chunk_allocate(void) { struct lttng_trace_chunk *chunk = NULL; - chunk = (lttng_trace_chunk *) zmalloc(sizeof(*chunk)); + chunk = zmalloc(); if (!chunk) { ERR("Failed to allocate trace chunk"); goto end; @@ -1007,6 +1007,7 @@ enum lttng_trace_chunk_status lttng_trace_chunk_set_credentials_current_user( enum lttng_trace_chunk_status status = LTTNG_TRACE_CHUNK_STATUS_OK; const struct chunk_credentials credentials = { .use_current_user = true, + .user = {}, }; pthread_mutex_lock(&chunk->lock); @@ -1639,7 +1640,7 @@ end: } static -int lttng_trace_chunk_no_operation(struct lttng_trace_chunk *trace_chunk) +int lttng_trace_chunk_no_operation(struct lttng_trace_chunk *trace_chunk __attribute__((unused))) { return 0; } @@ -1929,7 +1930,7 @@ struct lttng_trace_chunk_registry *lttng_trace_chunk_registry_create(void) { struct lttng_trace_chunk_registry *registry; - registry = (lttng_trace_chunk_registry *) zmalloc(sizeof(*registry)); + registry = zmalloc(); if (!registry) { goto end; } @@ -1965,7 +1966,7 @@ lttng_trace_chunk_registry_element_create_from_chunk( struct lttng_trace_chunk *chunk, uint64_t session_id) { struct lttng_trace_chunk_registry_element *element = - (lttng_trace_chunk_registry_element *) zmalloc(sizeof(*element)); + zmalloc(); if (!element) { goto end;