diff --git a/libvips/include/vips/type.h b/libvips/include/vips/type.h index a64f3062..4c12e602 100644 --- a/libvips/include/vips/type.h +++ b/libvips/include/vips/type.h @@ -51,7 +51,7 @@ typedef struct _VipsThing { #define VIPS_TYPE_THING (vips_thing_get_type()) GType vips_thing_get_type( void ); VipsThing *vips_thing_new( int i ); -int vips_thing_get_thing( VipsThing *thing ); +int vips_thing_get_i( VipsThing *thing ); /* A ref-counted area of memory. Can hold arrays of things as well. */ diff --git a/libvips/iofuncs/type.c b/libvips/iofuncs/type.c index aca685b4..06019b67 100644 --- a/libvips/iofuncs/type.c +++ b/libvips/iofuncs/type.c @@ -63,28 +63,47 @@ VipsThing * vips_thing_new( int i ) { - VipsThing *thing = g_new( VipsThing, 1); + VipsThing *thing; + thing = g_new( VipsThing, 1 ); thing->i = i; + printf( "vips_thing_new: %d %p\n", i, thing ); + return( thing ); } -VipsThing * +static VipsThing * vips_thing_copy( VipsThing *thing ) { - return( vips_thing_new( thing->i ) ); + VipsThing *thing2; + + thing2 = vips_thing_new( thing->i ); + + printf( "vips_thing_copy: %d %p = %p\n", thing->i, thing2, thing ); + + return( thing2 ); +} + +static void +vips_thing_free( VipsThing *thing ) +{ + printf( "vips_thing_free: %d %p\n", thing->i, thing ); + + g_free( thing ); } int -vips_thing_get_thing( VipsThing *thing ) +vips_thing_get_i( VipsThing *thing ) { + printf( "vips_thing_get_i: %d %p\n", thing->i, thing ); + return( thing->i ); } G_DEFINE_BOXED_TYPE( VipsThing, vips_thing, (GBoxedCopyFunc) vips_thing_copy, - (GBoxedFreeFunc) g_free ); + (GBoxedFreeFunc) vips_thing_free ); /**