void vips_buffer_dump_all( void ) { #ifdef DEBUG if( vips__buffer_all ) { size_t reserve; size_t alive; printf( "buffers:\n" ); reserve = 0; alive = 0; vips_slist_map2( vips__buffer_all, (VipsSListMap2Fn) vips_buffer_dump, &reserve, &alive ); printf( "%.3g MB alive\n", alive / (1024 * 1024.0) ); printf( "%.3g MB in reserve\n", reserve / (1024 * 1024.0) ); } #ifdef DEBUG_CREATE if( vips__buffer_cache_all ) { printf( "buffers: %d buffer cache still alive\n", g_slist_length( vips__buffer_cache_all ) ); vips_slist_map2( vips__buffer_cache_all, (VipsSListMap2Fn) vips_buffer_cache_dump, NULL, NULL ); printf( "g_thread_self() == %p\n", g_thread_self() ); } #endif /*DEBUG_CREATE*/ #endif /*DEBUG*/ }
/* Look up a child by name. */ static VipsGsfDirectory * vips_gsf_child_by_name( VipsGsfDirectory *dir, const char *name ) { return( vips_slist_map2( dir->children, (VipsSListMap2Fn) vips_gsf_child_by_name_sub, (char *) name, NULL ) ); }
static void meta_sanity( const VipsImage *im ) { if( im->meta ) g_hash_table_foreach( im->meta, (GHFunc) meta_sanity_on_traverse, (void *) im ); vips_slist_map2( im->meta_traverse, (VipsSListMap2Fn) meta_sanity_on_hash, (void *) im, NULL ); }
static void vips_exif_exif_content( ExifContent *content, VipsExifRemove *ve ) { ve->content = content; ve->to_remove = NULL; exif_content_foreach_entry( content, (ExifContentForeachEntryFunc) vips_exif_exif_entry, ve ); vips_slist_map2( ve->to_remove, (VipsSListMap2Fn) vips_exif_exif_remove, ve, NULL ); VIPS_FREEF( g_slist_free, ve->to_remove ); }
/* Copy meta on to dst. */ static int meta_cp( VipsImage *dst, const VipsImage *src ) { if( src->meta ) { /* Loop, copying fields. */ meta_init( dst ); vips_slist_map2( src->meta_traverse, (VipsSListMap2Fn) meta_cp_field, dst, NULL ); } return( 0 ); }
/* Close all dirs, non-NULL on error. */ static void * vips_gsf_tree_close( VipsGsfDirectory *tree ) { vips_slist_map2( tree->children, (VipsSListMap2Fn) vips_gsf_tree_close, NULL, NULL ); if( tree->out && !gsf_output_is_closed( tree->out ) && !gsf_output_close( tree->out ) ) { vips_error( "vips_gsf", "%s", _( "unable to close stream" ) ); return( tree ); } if( tree->container && !gsf_output_is_closed( tree->container ) && !gsf_output_close( tree->container ) ) { vips_error( "vips_gsf", "%s", _( "unable to close stream" ) ); return( tree ); } return( NULL ); }
/* Find an existing window that fits within top/height and return a ref. */ static VipsWindow * vips_window_find( IMAGE *im, int top, int height ) { request_t req; VipsWindow *window; req.top = top; req.height = height; window = vips_slist_map2( im->windows, (VipsSListMap2Fn) vips_window_fits, &req, NULL ); if( window ) { window->ref_count += 1; #ifdef DEBUG printf( "vips_window_find: ref window top = %d, height = %d, " "count = %d\n", top, height, window->ref_count ); #endif /*DEBUG*/ } return( window ); }
/* Close and unref everything, can't fail. Call vips_gsf_tree_close() to get * an error return. */ static void * vips_gsf_tree_free( VipsGsfDirectory *tree ) { vips_slist_map2( tree->children, (VipsSListMap2Fn) vips_gsf_tree_free, NULL, NULL ); g_slist_free( tree->children ); g_free( (char *) tree->name ); if( tree->out ) { if( !gsf_output_is_closed( tree->out ) ) (void) gsf_output_close( tree->out ); g_object_unref( tree->out ); } if( tree->container ) { if( !gsf_output_is_closed( tree->container ) ) (void) gsf_output_close( tree->container ); g_object_unref( tree->container ); } g_free( tree ); return( NULL ); }