From 81920963b1fd59f1080d3190ac617558b3689529 Mon Sep 17 00:00:00 2001 From: Kyle Schwarz Date: Sun, 2 Aug 2020 10:19:47 -0400 Subject: [PATCH] Remove cast in free() call --- libvips/include/vips/image.h | 2 +- libvips/iofuncs/image.c | 26 ++------------------------ 2 files changed, 3 insertions(+), 25 deletions(-) diff --git a/libvips/include/vips/image.h b/libvips/include/vips/image.h index e766b3fd..b0d97592 100644 --- a/libvips/include/vips/image.h +++ b/libvips/include/vips/image.h @@ -522,7 +522,7 @@ int vips_reorder_prepare_many( VipsImage *image, struct _VipsRegion **regions, VipsRect *r ); void vips_reorder_margin_hint( VipsImage *image, int margin ); -void vips_image_free_buffer( VipsImage* image, void* buffer ); +void vips_image_free_buffer( VipsImage *, void *buffer ); #ifdef __cplusplus } diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index f115905c..22b3255f 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -3882,31 +3882,9 @@ vips_band_format_iscomplex( VipsBandFormat format ) * allocated buffer. */ void -vips_image_free_buffer( VipsImage* image, void* buffer ) +vips_image_free_buffer( VipsImage *, void *buffer ) { - switch( vips_image_get_format( image ) ) { - case VIPS_FORMAT_UCHAR: - free( (unsigned char*)buffer ); break; - case VIPS_FORMAT_CHAR: - free( (char*)buffer ); break; - case VIPS_FORMAT_USHORT: - free( (unsigned short*)buffer ); break; - case VIPS_FORMAT_SHORT: - free( (short*)buffer ); break; - case VIPS_FORMAT_UINT: - free( (unsigned int*)buffer ); break; - case VIPS_FORMAT_INT: - free( (int*)buffer ); break; - case VIPS_FORMAT_FLOAT: - case VIPS_FORMAT_COMPLEX: - free( (float*)buffer ); break; - case VIPS_FORMAT_DOUBLE: - case VIPS_FORMAT_DPCOMPLEX: - free( (double*)buffer ); break; - - default: - g_assert_not_reached(); - } + free( buffer ); } /* Handy for debugging: view an image in nip2.