Speed up VIPS_ARGUMENT_COLLECT_SET

By using G_VALUE_COLLECT_INIT, see:
https://bugzilla.gnome.org/show_bug.cgi?id=603590
This commit is contained in:
Kleis Auke Wolthuizen 2020-10-10 19:48:52 +02:00
parent 302f1f70d9
commit e0b3e53c0e
1 changed files with 20 additions and 0 deletions

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