From 006ac293bc0c565a632a10d183adccebbaa38d3d Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Sun, 23 Jun 2024 23:09:00 +0200 Subject: [PATCH] vulkan: Replace open-coded precondition checks with g_return_val_if_fail While analyzing gst_vulkan_get_or_create_image_view_with_info() it seems obvious that this function returns NULL, and that this should be covered in the return annotations. However, closer inspection indicates that this is only a precondition check when the incoming arguments are incompatible with each other, and should not be considered as a function that optionally returns a pointer. Signify this by using precondition checks instead of an opencoded if-return-NULL. Part-of: --- .../gst-plugins-bad/gst-libs/gst/vulkan/gstvkutils.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkutils.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkutils.c index 6b85a4fb50..bc639ccab4 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkutils.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkutils.c @@ -493,9 +493,10 @@ gst_vulkan_get_or_create_image_view_with_info (GstVulkanImageMemory * image, fill_vulkan_image_view_info (image->image, image->create_info.format, &_create_info); create_info = &_create_info; - } else if (!(create_info->format == image->create_info.format - && create_info->image == image->image)) { - return NULL; + } else { + g_return_val_if_fail (create_info->format == image->create_info.format, + NULL); + g_return_val_if_fail (create_info->image == image->image, NULL); } ret = gst_vulkan_image_memory_find_view (image,