From: Øyvind Kolås Date: Fri, 16 Nov 2018 17:27:32 +0000 (+0100) Subject: babl: properly cache runtime inserted conversions X-Git-Tag: archive/raspbian/1%0.1.106-3+rpi1^2~15^2~12^2~57 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=c0a4a98e75d0acb2b572415987711c1ab5fe02ab;p=babl.git babl: properly cache runtime inserted conversions The old behavior of avoiding colliding names used in the conversion database is still used during loading of extension permitting multiple conversions to be registered for runtime profiling. --- diff --git a/babl/babl-conversion.c b/babl/babl-conversion.c index a7f7eba..011765c 100644 --- a/babl/babl-conversion.c +++ b/babl/babl-conversion.c @@ -235,7 +235,7 @@ _conversion_new (const char *name, BABL (babl->conversion.destination), babl_type_from_id (BABL_DOUBLE)); - { + if(0){ const Babl *fish = babl_conversion_find (src_format, dst_format); if (fish) return fish; @@ -284,6 +284,8 @@ create_name (Babl *source, Babl *destination, int type) const char * babl_conversion_create_name (Babl *source, Babl *destination, int type); +int _babl_loaded = 0; + const char * babl_conversion_create_name (Babl *source, Babl *destination, int type) { @@ -292,6 +294,9 @@ babl_conversion_create_name (Babl *source, Babl *destination, int type) int id = 0; collisions = 0; name = create_name (source, destination, type); + + if (!_babl_loaded) + { babl = babl_db_exist (db, id, name); while (babl) { @@ -302,6 +307,7 @@ babl_conversion_create_name (Babl *source, Babl *destination, int type) name = create_name (source, destination, type); babl = babl_db_exist (db, id, name); } + } return name; } diff --git a/babl/babl.c b/babl/babl.c index 4479f68..ef2cfb7 100644 --- a/babl/babl.c +++ b/babl/babl.c @@ -125,6 +125,8 @@ babl_dir_list (void) return ret; } +extern int _babl_loaded; + void babl_init (void) { @@ -133,6 +135,7 @@ babl_init (void) if (ref_count++ == 0) { char * dir_list; + _babl_loaded = 0; babl_internal_init (); babl_sampling_class_init (); @@ -155,6 +158,7 @@ babl_init (void) babl_free (dir_list); babl_init_db (); + _babl_loaded = 1; } }