add a test type
This commit is contained in:
parent
429c9977d4
commit
23807b5999
@ -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.
|
||||
*/
|
||||
|
@ -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 );
|
||||
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user