From f8f288c1a6d0ec19c41151777b5df97e775b825d Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Fri, 29 Aug 2014 13:51:03 +0100 Subject: [PATCH] vips_init() comes back we need a public function for bindings --- ChangeLog | 1 + libvips/deprecated/vips7compat.c | 10 +++++++++- libvips/include/vips/private.h | 2 +- libvips/include/vips/vips.h | 4 +++- libvips/include/vips/vips7compat.h | 4 ---- libvips/iofuncs/init.c | 18 ++++++++++++++---- 6 files changed, 28 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a21991d..10edbef1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,7 @@ - start working on --disable-deprecated - fix pngload with libpng >1.6.1 - add vips_resize() +- return of vips_init(), but just for bindings 21/8/14 started 7.40.7 - width and height were swapped in matlab load diff --git a/libvips/deprecated/vips7compat.c b/libvips/deprecated/vips7compat.c index 5890b2a8..e914b668 100644 --- a/libvips/deprecated/vips7compat.c +++ b/libvips/deprecated/vips7compat.c @@ -422,7 +422,7 @@ im_init( const char *filename ) int im_init_world( const char *argv0 ) { - return( vips__init( argv0 ) ); + return( vips_init( argv0 ) ); } /* Prettyprint various header fields. Just for vips7 compat, use @@ -5347,3 +5347,11 @@ im_insertset( IMAGE *main, IMAGE *sub, IMAGE *out, int n, int *x, int *y ) return( 0 ); } + +/* We had this entry point in earlier libvipses, hilariously. + */ +int +vips__init( const char *argv0 ) +{ + return( vips_init( argv0 ) ); +} diff --git a/libvips/include/vips/private.h b/libvips/include/vips/private.h index a1ee8ebc..84e46977 100644 --- a/libvips/include/vips/private.h +++ b/libvips/include/vips/private.h @@ -56,7 +56,7 @@ extern "C" { */ #define VIPS_SIZEOF_HEADER (64) -/* Startup plus ABI check. +/* Startup ABI check. */ int vips__init( const char *argv0 ); size_t vips__get_sizeof_vipsobject( void ); diff --git a/libvips/include/vips/vips.h b/libvips/include/vips/vips.h index d61cdce3..31d4fe6e 100644 --- a/libvips/include/vips/vips.h +++ b/libvips/include/vips/vips.h @@ -175,7 +175,9 @@ extern "C" { sizeof( VipsObject ) ), \ vips_error( "vips_init", "ABI mismatch" ), \ -1 ) : \ - vips__init( ARGV0 )) + vips_init( ARGV0 )) + +int vips_init( const char *argv0 ); const char *vips_get_argv0( void ); void vips_shutdown( void ); diff --git a/libvips/include/vips/vips7compat.h b/libvips/include/vips/vips7compat.h index 23ee74d1..cc275eb4 100644 --- a/libvips/include/vips/vips7compat.h +++ b/libvips/include/vips/vips7compat.h @@ -266,10 +266,6 @@ vips_image_new_mode( const char *filename, const char *mode ); int im_init_world( const char *argv0 ); -/* We used to have this in lowercase. - */ -#define vips_init(X) VIPS_INIT(X) - VipsImage *im_open( const char *filename, const char *mode ); VipsImage *im_open_local( VipsImage *parent, diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index bb6e8fe8..06349abb 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -166,12 +166,22 @@ vips_get_argv0( void ) * Returns: 0 on success, -1 otherwise */ -/* vips_init() is a macro which checks library and application - * compatibility before calling vips__init(). +/** + * vips_init: + * @argv0: name of application + * + * This function starts up libvips, see VIPS_INIT(). + * + * This function is for bindings which need to start up vips. C programs + * should use the VIPS_INIT() macro, which does some extra checks. + * + * See also: VIPS_INIT(). + * + * Returns: 0 on success, -1 otherwise */ int -vips__init( const char *argv0 ) +vips_init( const char *argv0 ) { extern GType vips_system_get_type( void ); @@ -349,7 +359,7 @@ vips_check_init( void ) * for old programs which are missing an vips_init() call. We need * i18n set up before we can translate. */ - if( vips__init( "vips" ) ) + if( vips_init( "vips" ) ) vips_error_clear(); }