From ee88271d06b8ecc58c777bd4ce1acafe12413872 Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Sat, 26 Apr 2014 18:45:13 +0100 Subject: [PATCH] use VIPS_ prefix for env vars stuff --- TODO | 33 ++------------------------------- libvips/foreign/foreign.c | 3 ++- libvips/iofuncs/error.c | 5 +++-- libvips/iofuncs/image.c | 3 ++- libvips/iofuncs/init.c | 3 ++- libvips/iofuncs/threadpool.c | 15 ++++++--------- libvips/iofuncs/vector.c | 3 ++- 7 files changed, 19 insertions(+), 46 deletions(-) diff --git a/TODO b/TODO index 98e50806..4d102e7f 100644 --- a/TODO +++ b/TODO @@ -1,47 +1,18 @@ - clean in nip2 is broken - looks like the offset in morph embed is wrong + works if you use --vips-novector - no, worse, try - - 0 0 0 - 0 1 0 - 0 0 0 - - erode ... fails badly - - try with vector disabled? - - -- make all - - if( (env = g_getenv( "IM_DISC_THRESHOLD" )) ) - - be eg. - - if( (env = g_getenv( "VIPS_DISC_THRESHOLD" )) || - (env = g_getenv( "IM_DISC_THRESHOLD" )) ) + 14.04 is orc-0.4.18, there must have been a change -- use this for dzsave_buffer - - - -- clean up foreign.c, there seems to be some cruft - - vips_filename_suffix_match() is used by vips_foreign_load_new_from_foreign_sub(), but it splits on ':' ... argh! deprecate this thing and stop ':' split - vips_foreign_find_save() should split on [], there's something to find the - start of the rightmost [] pair, use that - - see also vips_foreign_find_save_buffer() - diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index df9bbf83..a8b23b7d 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -744,7 +744,8 @@ vips_get_disc_threshold( void ) */ threshold = 100 * 1024 * 1024; - if( (env = g_getenv( "IM_DISC_THRESHOLD" )) ) + if( (env = g_getenv( "VIPS_DISC_THRESHOLD" )) || + (env = g_getenv( "IM_DISC_THRESHOLD" )) ) threshold = vips__parse_size( env ); if( vips__disc_threshold ) diff --git a/libvips/iofuncs/error.c b/libvips/iofuncs/error.c index 28cc8d99..aff61d58 100644 --- a/libvips/iofuncs/error.c +++ b/libvips/iofuncs/error.c @@ -408,7 +408,7 @@ vips_info( const char *domain, const char *fmt, ... ) * @ap: arguments to the format string * * Sends a formatted warning message to stderr. If you define the - * environment variable IM_WARNING, these message are surpressed. + * environment variable VIPS_WARNING, these message are surpressed. * * Warning messages are used to report things like overflow counts. * @@ -417,7 +417,8 @@ vips_info( const char *domain, const char *fmt, ... ) void vips_vwarn( const char *domain, const char *fmt, va_list ap ) { - if( !g_getenv( "IM_WARNING" ) ) { + if( !g_getenv( "IM_WARNING" ) && + !g_getenv( "VIPS_WARNING" ) ) { g_mutex_lock( vips__global_lock ); (void) fprintf( stderr, _( "%s: " ), _( "vips warning" ) ); if( domain ) diff --git a/libvips/iofuncs/image.c b/libvips/iofuncs/image.c index 9b3b4a56..5a70ddc5 100644 --- a/libvips/iofuncs/image.c +++ b/libvips/iofuncs/image.c @@ -737,6 +737,7 @@ static void vips_image_add_progress( VipsImage *image ) { if( vips__progress || + g_getenv( "VIPS_PROGRESS" ) || g_getenv( "IM_PROGRESS" ) ) { /* Keep the %complete we displayed last time here. @@ -1578,7 +1579,7 @@ vips_image_new( void ) * location for the temporary file. * * The disc threshold can be set with the "--vips-disc-threshold" - * command-line argument, or the IM_DISC_THRESHOLD environment variable. + * command-line argument, or the VIPS_DISC_THRESHOLD environment variable. * The value is a simple integer, but can take a unit postfix of "k", * "m" or "g" to indicate kilobytes, megabytes or gigabytes. * diff --git a/libvips/iofuncs/init.c b/libvips/iofuncs/init.c index ced93528..89fbe645 100644 --- a/libvips/iofuncs/init.c +++ b/libvips/iofuncs/init.c @@ -244,7 +244,8 @@ vips__init( const char *argv0 ) /* Default info setting from env. */ - if( g_getenv( "IM_INFO" ) ) + if( g_getenv( "VIPS_INFO" ) || + g_getenv( "IM_INFO" ) ) vips__info = 1; /* Register base vips types. diff --git a/libvips/iofuncs/threadpool.c b/libvips/iofuncs/threadpool.c index e17d05af..b2396a73 100644 --- a/libvips/iofuncs/threadpool.c +++ b/libvips/iofuncs/threadpool.c @@ -82,14 +82,10 @@ */ /* Maximum number of concurrent threads we allow. No reason for the limit, - * it's just there to stop mad values for IM_CONCURRENCY killing the system. + * it's just there to stop mad values for VIPS_CONCURRENCY killing the system. */ #define MAX_THREADS (1024) -/* Name of environment variable we get concurrency level from. - */ -#define IM_CONCURRENCY "IM_CONCURRENCY" - /* Default tile geometry ... can be set by init_world. */ int vips__tile_width = VIPS__TILE_WIDTH; @@ -220,7 +216,7 @@ vips_g_thread_new( const char *domain, GThreadFunc func, gpointer data ) * #VipsThreadPool. * * The special value 0 means "default". In this case, the number of threads is - * set by the environmnt variable IM_CONCURRENCY, or if that is not set, the + * set by the environmnt variable VIPS_CONCURRENCY, or if that is not set, the * number of threads availble on the hist machine. * * See also: vips_concurrency_get(). @@ -307,9 +303,9 @@ get_num_processors( void ) * "--vips-concurrency" to set this value. * * If vips_concurrency_set() has not been called and no command-line argument - * was used, vips uses the value of the environment variable IM_CONCURRENCY, + * was used, vips uses the value of the environment variable VIPS_CONCURRENCY, * - * If IM_CONCURRENCY has not been set, vips find the number of hardware + * If VIPS_CONCURRENCY has not been set, vips find the number of hardware * threads that the host machine can run in parallel and uses that value. * * The final value is clipped to the range 1 - 1024. @@ -329,7 +325,8 @@ vips_concurrency_get( void ) */ if( vips__concurrency > 0 ) nthr = vips__concurrency; - else if( (str = g_getenv( IM_CONCURRENCY )) && + else if( ((str = g_getenv( "VIPS_CONCURRENCY" )) || + (str = g_getenv( "IM_CONCURRENCY" ))) && (x = atoi( str )) > 0 ) nthr = x; else diff --git a/libvips/iofuncs/vector.c b/libvips/iofuncs/vector.c index 6c772e65..565973f1 100644 --- a/libvips/iofuncs/vector.c +++ b/libvips/iofuncs/vector.c @@ -77,7 +77,8 @@ vips_vector_init( void ) /* Look for the environment variable IM_NOVECTOR and use that to turn * off as well. */ - if( g_getenv( "IM_NOVECTOR" ) ) + if( g_getenv( "VIPS_NOVECTOR" ) || + g_getenv( "IM_NOVECTOR" ) ) vips__vector_enabled = FALSE; #endif /*HAVE_ORC*/ }