From bc0bde85cbfd13ee25f04dae005d6c1c78573d2a Mon Sep 17 00:00:00 2001 From: John Cupitt Date: Tue, 11 Oct 2016 14:12:45 +0100 Subject: [PATCH] remove a couple of statics g_once() is fast enough --- libvips/colour/LabQ2sRGB.c | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/libvips/colour/LabQ2sRGB.c b/libvips/colour/LabQ2sRGB.c index 06b6c285..28364b44 100644 --- a/libvips/colour/LabQ2sRGB.c +++ b/libvips/colour/LabQ2sRGB.c @@ -169,17 +169,9 @@ calcul_tables_8( void *client ) static void vips_col_make_tables_RGB_8( void ) { - static gboolean made_tables = FALSE; + static GOnce once = G_ONCE_INIT; - /* We want to avoid having a mutex in this path, so use gonce and a - * static var instead. - */ - if( !made_tables ) { - static GOnce once = G_ONCE_INIT; - - (void) g_once( &once, calcul_tables_8, NULL ); - made_tables = TRUE; - } + (void) g_once( &once, calcul_tables_8, NULL ); } int @@ -201,17 +193,9 @@ calcul_tables_16( void *client ) static void vips_col_make_tables_RGB_16( void ) { - static gboolean made_tables = FALSE; + static GOnce once = G_ONCE_INIT; - /* We want to avoid having a mutex in this path, so use gonce and a - * static var instead. - */ - if( !made_tables ) { - static GOnce once = G_ONCE_INIT; - - (void) g_once( &once, calcul_tables_16, NULL ); - made_tables = TRUE; - } + (void) g_once( &once, calcul_tables_16, NULL ); } int