Merge pull request #1852 from kleisauke/vips-argument-collect-set

Speed up VIPS_ARGUMENT_COLLECT_SET
This commit is contained in:
John Cupitt 2020-10-11 19:34:23 +01:00 committed by GitHub
commit 8d4852f217
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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 ); \