don't set g_set_prgname()
this should be set in the app layer, not by libraries
This commit is contained in:
parent
889ca96648
commit
eca400e953
@ -170,8 +170,8 @@ extern "C" {
|
||||
vips_init( ARGV0 ))
|
||||
|
||||
int vips_init( const char *argv0 );
|
||||
|
||||
const char *vips_get_argv0( void );
|
||||
const char *vips_get_prgname( void );
|
||||
void vips_shutdown( void );
|
||||
void vips_thread_shutdown( void );
|
||||
|
||||
|
@ -430,7 +430,7 @@ vips_error_exit( const char *fmt, ... )
|
||||
if( fmt ) {
|
||||
va_list ap;
|
||||
|
||||
fprintf( stderr, "%s: ", g_get_prgname() );
|
||||
fprintf( stderr, "%s: ", vips_get_prgname() );
|
||||
|
||||
va_start( ap, fmt );
|
||||
(void) vfprintf( stderr, fmt, ap );
|
||||
|
@ -760,7 +760,7 @@ vips_image_preeval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
||||
&tile_width, &tile_height, &n_lines );
|
||||
printf( _( "%s %s: %d x %d pixels, %d threads, %d x %d tiles, "
|
||||
"%d lines in buffer" ),
|
||||
g_get_prgname(), image->filename,
|
||||
vips_get_prgname(), image->filename,
|
||||
image->Xsize, image->Ysize,
|
||||
vips_concurrency_get(),
|
||||
tile_width, tile_height, n_lines );
|
||||
@ -772,7 +772,7 @@ vips_image_eval_cb( VipsImage *image, VipsProgress *progress, int *last )
|
||||
{
|
||||
if( progress->percent != *last ) {
|
||||
printf( _( "%s %s: %d%% complete" ),
|
||||
g_get_prgname(), image->filename,
|
||||
vips_get_prgname(), image->filename,
|
||||
progress->percent );
|
||||
printf( "\r" );
|
||||
fflush( stdout );
|
||||
@ -791,7 +791,7 @@ vips_image_posteval_cb( VipsImage *image, VipsProgress *progress, void *data )
|
||||
/* Spaces at end help to erase the %complete message we overwrite.
|
||||
*/
|
||||
printf( _( "%s %s: done in %.3gs \n" ),
|
||||
g_get_prgname(), image->filename,
|
||||
vips_get_prgname(), image->filename,
|
||||
g_timer_elapsed( progress->start, NULL ) );
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,10 @@ GTimer *vips__global_timer = NULL;
|
||||
*/
|
||||
static char *vips__argv0 = NULL;
|
||||
|
||||
/* Keep a copy of the last component of argv0 here.
|
||||
*/
|
||||
static char *vips__prgname = NULL;
|
||||
|
||||
/* Leak check on exit.
|
||||
*/
|
||||
int vips__leak = 0;
|
||||
@ -143,7 +147,8 @@ static gint64 vips_pipe_read_limit = 1024 * 1024 * 1024;
|
||||
*
|
||||
* See also: VIPS_INIT().
|
||||
*
|
||||
* Returns: a pointer to an internal copy of the argv0 string passed to
|
||||
* Returns: (transfer none): a pointer to an internal copy of the
|
||||
* argv0 string passed to
|
||||
* VIPS_INIT(). Do not free this value
|
||||
*/
|
||||
const char *
|
||||
@ -152,6 +157,27 @@ vips_get_argv0( void )
|
||||
return( vips__argv0 );
|
||||
}
|
||||
|
||||
/**
|
||||
* vips_get_prgname:
|
||||
*
|
||||
* Return the program name. This can be useful for the user tio see,.
|
||||
*
|
||||
* See also: VIPS_INIT().
|
||||
*
|
||||
* Returns: (transfer none): a pointer to an internal copy of the program
|
||||
* name. Do not free this value
|
||||
*/
|
||||
const char *
|
||||
vips_get_prgname( void )
|
||||
{
|
||||
const char *prgname;
|
||||
|
||||
if( (prgname = g_get_prgname()) )
|
||||
return( prgname );
|
||||
else
|
||||
return( vips__prgname );
|
||||
}
|
||||
|
||||
/**
|
||||
* VIPS_INIT:
|
||||
* @ARGV0: name of application
|
||||
@ -422,14 +448,7 @@ vips_init( const char *argv0 )
|
||||
vips__global_timer = g_timer_new();
|
||||
|
||||
VIPS_SETSTR( vips__argv0, argv0 );
|
||||
|
||||
if( argv0 ) {
|
||||
char *prgname;
|
||||
|
||||
prgname = g_path_get_basename( argv0 );
|
||||
g_set_prgname( prgname );
|
||||
g_free( prgname );
|
||||
}
|
||||
vips__prgname = g_path_get_basename( argv0 );
|
||||
|
||||
vips__thread_profile_attach( "main" );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user