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: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5736>
This commit is contained in:
Marijn Suijten 2024-06-23 23:09:00 +02:00 committed by GStreamer Marge Bot
parent 10464f352f
commit 006ac293bc

View file

@ -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,