X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fcommon%2Fcompat%2Fdirectory-handle.cpp;h=cd4bf1769a739c189576716096304dea956aa70a;hb=9a30ba1da4e6d59eb30c6535a9dd04cd599e6fae;hp=5bfb4b9eee2a94c03af9ec4f94e1d4b840740e86;hpb=c922647daed3dd022be11980063b5fb816d8c091;p=lttng-tools.git diff --git a/src/common/compat/directory-handle.cpp b/src/common/compat/directory-handle.cpp index 5bfb4b9ee..cd4bf1769 100644 --- a/src/common/compat/directory-handle.cpp +++ b/src/common/compat/directory-handle.cpp @@ -5,13 +5,13 @@ * */ -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include -#include +#include #include #include @@ -147,7 +147,7 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_dirfd( int dirfd) { int ret; - struct lttng_directory_handle *handle = (lttng_directory_handle *) zmalloc(sizeof(*handle)); + struct lttng_directory_handle *handle = zmalloc(); struct stat stat_buf; if (!handle) { @@ -176,7 +176,7 @@ void lttng_directory_handle_release(struct urcu_ref *ref) { int ret; struct lttng_directory_handle *handle = - container_of(ref, struct lttng_directory_handle, ref); + lttng::utils::container_of(ref, <tng_directory_handle::ref); if (handle->destroy_cb) { handle->destroy_cb(handle, handle->destroy_cb_data); @@ -405,7 +405,7 @@ end: static struct lttng_directory_handle *_lttng_directory_handle_create(char *path) { - struct lttng_directory_handle *handle = zmalloc(sizeof(*handle)); + struct lttng_directory_handle *handle = zmalloc(); if (!handle) { goto end; @@ -525,7 +525,7 @@ struct lttng_directory_handle *lttng_directory_handle_create_from_handle( handle_path_len, LTTNG_PATH_MAX); goto end; } - new_path = zmalloc(handle_path_len); + new_path = zmalloc(handle_path_len); if (!new_path) { PERROR("Failed to initialize directory handle"); goto end; @@ -557,7 +557,7 @@ static void lttng_directory_handle_release(struct urcu_ref *ref) { struct lttng_directory_handle *handle = - container_of(ref, struct lttng_directory_handle, ref); + lttng::utils::container_of(ref, <tng_directory_handle::ref); free(handle->base_path); lttng_directory_handle_invalidate(handle); @@ -1151,6 +1151,7 @@ int lttng_directory_handle_remove_subdirectory_as_user( return ret; } +namespace { struct rmdir_frame { ssize_t parent_frame_idx; DIR *dir; @@ -1158,6 +1159,7 @@ struct rmdir_frame { /* Size including '\0'. */ size_t path_size; }; +} /* namespace */ static void rmdir_frame_fini(void *data)