diff --git a/libvips/include/vips/object.h b/libvips/include/vips/object.h index f83ee461..5cda33d3 100644 --- a/libvips/include/vips/object.h +++ b/libvips/include/vips/object.h @@ -365,6 +365,25 @@ int vips_object_get_argument_priority( VipsObject *object, const char *name ); VIPS_ARGUMENT_COLLECT_END */ +#if GLIB_CHECK_VERSION( 2, 24, 0 ) +#define VIPS_ARGUMENT_COLLECT_SET( PSPEC, ARG_CLASS, AP ) \ + if( (ARG_CLASS->flags & VIPS_ARGUMENT_INPUT) ) { \ + GValue value = { 0, }; \ + gchar *error = NULL; \ + \ + /* Input args are given inline, eg. ("factor", 12.0) \ + * and must be collected. \ + */ \ + G_VALUE_COLLECT_INIT( &value, \ + G_PARAM_SPEC_VALUE_TYPE( PSPEC ), AP, 0, &error ); \ + \ + /* Don't bother with the error message. \ + */ \ + if( error ) { \ + VIPS_DEBUG_MSG( "VIPS_OBJECT_COLLECT_SET: err\n" ); \ + g_free( error ); \ + } +#else #define VIPS_ARGUMENT_COLLECT_SET( PSPEC, ARG_CLASS, AP ) \ if( (ARG_CLASS->flags & VIPS_ARGUMENT_INPUT) ) { \ GValue value = { 0, }; \ @@ -382,6 +401,7 @@ int vips_object_get_argument_priority( VipsObject *object, const char *name ); VIPS_DEBUG_MSG( "VIPS_OBJECT_COLLECT_SET: err\n" ); \ g_free( error ); \ } +#endif #define VIPS_ARGUMENT_COLLECT_GET( PSPEC, ARG_CLASS, AP ) \ g_value_unset( &value ); \