From 1b0694b79481643cb456d03e1be50a1b4f6ca591 Mon Sep 17 00:00:00 2001 From: Alexander Orzechowski Date: Tue, 3 Oct 2023 01:51:07 -0400 Subject: treewide: Migrate from sizeof(struct) to sizeof(*pointer) where practical --- render/vulkan/pass.c | 6 +++--- render/vulkan/renderer.c | 6 +++--- render/vulkan/texture.c | 3 +-- 3 files changed, 7 insertions(+), 8 deletions(-) (limited to 'render/vulkan') diff --git a/render/vulkan/pass.c b/render/vulkan/pass.c index afdcae80..ea7ec42c 100644 --- a/render/vulkan/pass.c +++ b/render/vulkan/pass.c @@ -118,9 +118,9 @@ static bool render_pass_submit(struct wlr_render_pass *wlr_pass) { // insert acquire and release barriers for dmabuf-images uint32_t barrier_count = wl_list_length(&renderer->foreign_textures) + 1; - VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier)); - VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier)); - render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(VkSemaphoreSubmitInfoKHR)); + VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(*acquire_barriers)); + VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(*release_barriers)); + render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(*render_wait)); if (acquire_barriers == NULL || release_barriers == NULL || render_wait == NULL) { wlr_log_errno(WLR_ERROR, "Allocation failed"); free(acquire_barriers); diff --git a/render/vulkan/renderer.c b/render/vulkan/renderer.c index d1c3a965..6a0a597c 100644 --- a/render/vulkan/renderer.c +++ b/render/vulkan/renderer.c @@ -1117,9 +1117,9 @@ static void vulkan_end(struct wlr_renderer *wlr_renderer) { // insert acquire and release barriers for dmabuf-images unsigned barrier_count = wl_list_length(&renderer->foreign_textures) + 1; - VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier)); - VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(VkImageMemoryBarrier)); - VkSemaphoreSubmitInfoKHR *render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(VkSemaphoreSubmitInfoKHR)); + VkImageMemoryBarrier *acquire_barriers = calloc(barrier_count, sizeof(*acquire_barriers)); + VkImageMemoryBarrier *release_barriers = calloc(barrier_count, sizeof(*release_barriers)); + VkSemaphoreSubmitInfoKHR *render_wait = calloc(barrier_count * WLR_DMABUF_MAX_PLANES, sizeof(*render_wait)); if (acquire_barriers == NULL || release_barriers == NULL || render_wait == NULL) { wlr_log_errno(WLR_ERROR, "Allocation failed"); free(acquire_barriers); diff --git a/render/vulkan/texture.c b/render/vulkan/texture.c index 83a22c81..65ea22ba 100644 --- a/render/vulkan/texture.c +++ b/render/vulkan/texture.c @@ -256,8 +256,7 @@ static const struct wlr_texture_impl texture_impl = { static struct wlr_vk_texture *vulkan_texture_create( struct wlr_vk_renderer *renderer, uint32_t width, uint32_t height) { - struct wlr_vk_texture *texture = - calloc(1, sizeof(struct wlr_vk_texture)); + struct wlr_vk_texture *texture = calloc(1, sizeof(*texture)); if (texture == NULL) { wlr_log_errno(WLR_ERROR, "Allocation failed"); return NULL; -- cgit v1.2.3