Skip to content

Commit

Permalink
small fixes to make helgrind pass
Browse files Browse the repository at this point in the history
nothing significant, but watermark.c now passes helgrind cleanly
  • Loading branch information
jcupitt committed Mar 27, 2017
1 parent cf93828 commit 73c370e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
10 changes: 8 additions & 2 deletions libvips/iofuncs/memory.c
Expand Up @@ -262,13 +262,19 @@ vips_tracked_free( void *s )
VIPS_GATE_FREE( size );
}

static void
vips_tracked_init_mutex( void )
{
vips_tracked_mutex = vips_g_mutex_new();
}

static void
vips_tracked_init( void )
{
static GOnce vips_tracked_once = G_ONCE_INIT;

vips_tracked_mutex = g_once( &vips_tracked_once,
(GThreadFunc) vips_g_mutex_new, NULL );
g_once( &vips_tracked_once,
(GThreadFunc) vips_tracked_init_mutex, NULL );
}

/**
Expand Down
19 changes: 9 additions & 10 deletions libvips/iofuncs/object.c
Expand Up @@ -2772,20 +2772,20 @@ vips_class_add_hash( VipsObjectClass *class, GHashTable *table )
return( NULL );
}

static void *
static void
vips_class_build_hash( void )
{
GHashTable *table;
GType base;

table = g_hash_table_new( g_str_hash, g_str_equal );
vips__object_nickname_table =
g_hash_table_new( g_str_hash, g_str_equal );

if( !(base = g_type_from_name( "VipsObject" )) )
return( NULL );
vips_class_map_all( base,
(VipsClassMapFn) vips_class_add_hash, (void *) table );
base = g_type_from_name( "VipsObject" );
g_assert( base );

return( table );
vips_class_map_all( base,
(VipsClassMapFn) vips_class_add_hash,
(void *) vips__object_nickname_table );
}

/**
Expand Down Expand Up @@ -2814,8 +2814,7 @@ vips_type_find( const char *basename, const char *nickname )
GType base;
GType type;

vips__object_nickname_table = (GHashTable *) g_once( &once,
(GThreadFunc) vips_class_build_hash, NULL );
g_once( &once, (GThreadFunc) vips_class_build_hash, NULL );

hit = (NicknameGType *)
g_hash_table_lookup( vips__object_nickname_table,
Expand Down

0 comments on commit 73c370e

Please sign in to comment.