[Mesa-dev] [PATCH 1/2] i965: remove unnecessary `if`
Chris Wilson
chris at chris-wilson.co.uk
Mon Aug 15 14:27:01 UTC 2016
On Mon, Aug 15, 2016 at 03:16:12PM +0100, Eric Engestrom wrote:
> if (x) return true; else return false;
> can be simplified as:
> return x;
> since both `x` are already boolean expressions.
>
> Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
> ---
> src/mesa/drivers/dri/i965/intel_screen.c | 8 ++------
> 1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/intel_screen.c b/src/mesa/drivers/dri/i965/intel_screen.c
> index ae51c40..cef6005 100644
> --- a/src/mesa/drivers/dri/i965/intel_screen.c
> +++ b/src/mesa/drivers/dri/i965/intel_screen.c
> @@ -603,13 +603,9 @@ intel_query_image(__DRIimage *image, int attrib, int *value)
> *value = image->planar_format->components;
> return true;
> case __DRI_IMAGE_ATTRIB_FD:
> - if (drm_intel_bo_gem_export_to_prime(image->bo, value) == 0)
> - return true;
> - return false;
> + return drm_intel_bo_gem_export_to_prime(image->bo, value) == 0;
Elsewhere in this block we have
return !drm_intel_bo_flink(image->bo, (uint32_t *)value);
so choose between making both == 0 or !.
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
More information about the mesa-dev
mailing list