From 3d081c45be8e329bb5ab05f50f51b3174fbab164 Mon Sep 17 00:00:00 2001 From: Marijn Suijten Date: Tue, 5 Jan 2021 22:33:12 +0100 Subject: [PATCH] vulkan: Remove unnecessary null checks These null checkes are slightly misleading when double-checking mutability for external language interop. None of the functions in these files allow the variable at hand to become `NULL` under normal operation, because they are checked at initialization and never (allowed to be) reassigned to `NULL`. Part-of: --- .../gst-plugins-bad/gst-libs/gst/vulkan/gstvkcommandpool.c | 2 +- .../gst-plugins-bad/gst-libs/gst/vulkan/gstvkdescriptorpool.c | 2 +- subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdevice.c | 2 +- .../gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c | 2 +- subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkqueue.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkcommandpool.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkcommandpool.c index eb9255a88d..452d7ded3b 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkcommandpool.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkcommandpool.c @@ -118,7 +118,7 @@ gst_vulkan_command_pool_get_queue (GstVulkanCommandPool * pool) { g_return_val_if_fail (GST_IS_VULKAN_COMMAND_POOL (pool), NULL); - return pool->queue ? gst_object_ref (pool->queue) : NULL; + return gst_object_ref (pool->queue); } static GstVulkanCommandBuffer * diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdescriptorpool.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdescriptorpool.c index 99be8eda24..58303a144e 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdescriptorpool.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdescriptorpool.c @@ -132,7 +132,7 @@ gst_vulkan_descriptor_pool_get_device (GstVulkanDescriptorPool * pool) { g_return_val_if_fail (GST_IS_VULKAN_DESCRIPTOR_POOL (pool), NULL); - return pool->device ? gst_object_ref (pool->device) : NULL; + return gst_object_ref (pool->device); } /** diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdevice.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdevice.c index 005bf98029..0f83d91c30 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdevice.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkdevice.c @@ -454,7 +454,7 @@ gst_vulkan_device_get_instance (GstVulkanDevice * device) { g_return_val_if_fail (GST_IS_VULKAN_DEVICE (device), NULL); - return device->instance ? gst_object_ref (device->instance) : NULL; + return gst_object_ref (device->instance); } /** diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c index 33f9f20553..c2dee3cf32 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkphysicaldevice.c @@ -968,7 +968,7 @@ gst_vulkan_physical_device_get_instance (GstVulkanPhysicalDevice * device) { g_return_val_if_fail (GST_IS_VULKAN_PHYSICAL_DEVICE (device), NULL); - return device->instance ? gst_object_ref (device->instance) : NULL; + return gst_object_ref (device->instance); } static gboolean diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkqueue.c b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkqueue.c index f457000ad2..4e463ec33e 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkqueue.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/vulkan/gstvkqueue.c @@ -106,7 +106,7 @@ gst_vulkan_queue_get_device (GstVulkanQueue * queue) { g_return_val_if_fail (GST_IS_VULKAN_QUEUE (queue), NULL); - return queue->device ? gst_object_ref (queue->device) : NULL; + return gst_object_ref (queue->device); } /**