Skip to content

Commit 1568ecd

Browse files
committed
Merge branch 'master' of github.com:jcupitt/nip2
2 parents 91c8565 + 3be5a86 commit 1568ecd

File tree

2 files changed

+11
-18
lines changed

2 files changed

+11
-18
lines changed

src/imageinfo.c

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -470,36 +470,29 @@ static void
470470
imageinfo_finalize( GObject *gobject )
471471
{
472472
Imageinfo *imageinfo = IMAGEINFO( gobject );
473-
gboolean isfile = imageinfo->im ? im_isfile( imageinfo->im ) : FALSE;
474-
char name[FILENAME_MAX];
473+
gboolean isfile = imageinfo->im && im_isfile( imageinfo->im );
475474

476475
#ifdef DEBUG_MAKE
477476
printf( "imageinfo_finalize:" );
478477
imageinfo_print( imageinfo );
479478
#endif /*DEBUG_MAKE*/
480479

481-
if( imageinfo->dfile && isfile ) {
482-
/* We must close before we delete ... save the filename.
483-
*/
484-
im_strncpy( name, imageinfo->im->filename, FILENAME_MAX - 5 );
485-
486-
#ifdef DEBUG_OPEN
487-
printf( "imageinfo_destroy: unlinking \"%s\"\n", name );
488-
#endif /*DEBUG_OPEN*/
489-
}
490-
491480
IM_FREEF( im_close, imageinfo->im );
492481
IM_FREEF( im_close, imageinfo->mapped_im );
493482
IM_FREEF( im_close, imageinfo->identity_lut );
494483

495484
if( imageinfo->dfile &&
496-
imageinfo->delete_name &&
485+
imageinfo->delete_filename &&
497486
isfile ) {
498-
unlinkf( "%s", imageinfo->delete_name );
487+
#ifdef DEBUG_OPEN
488+
printf( "imageinfo_destroy: unlinking \"%s\"\n", name );
489+
#endif /*DEBUG_OPEN*/
490+
491+
unlinkf( "%s", imageinfo->delete_filename );
499492
iobject_changed( IOBJECT( main_imageinfogroup ) );
500493
}
501494

502-
VIPS_FREE( imageinfo->delete_name );
495+
VIPS_FREE( imageinfo->delete_filename );
503496

504497
MANAGED_UNREF( imageinfo->underlying );
505498

@@ -630,7 +623,7 @@ imageinfo_init( Imageinfo *imageinfo )
630623
imageinfo->proxy = NULL;
631624

632625
imageinfo->dfile = FALSE;
633-
imageinfo->delete_name = NULL;
626+
imageinfo->delete_filename = NULL;
634627
imageinfo->from_file = FALSE;
635628
imageinfo->mtime = 0;
636629
imageinfo->exprs = NULL;
@@ -817,7 +810,7 @@ imageinfo_new_temp( Imageinfogroup *imageinfogroup,
817810
return( NULL );
818811
}
819812
imageinfo->dfile = TRUE;
820-
VIPS_SETSTR( imageinfo->delete_name, tname );
813+
VIPS_SETSTR( imageinfo->delete_filename, tname );
821814

822815
return( imageinfo );
823816
}

src/imageinfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ struct _Imageinfo {
121121
Imageinfoproxy *proxy; /* Proxy for IMAGE callbacks */
122122

123123
gboolean dfile; /* delete_file on final close */
124-
char *delete_name; /* the filename we unlink */
124+
char *delete_filename; /* and the file we delete */
125125

126126
gboolean from_file; /* Set if ->name is a user file */
127127
time_t mtime; /* What mtime was when we loaded this file */

0 commit comments

Comments
 (0)