diff options
author | Sven Neumann <sven@gimp.org> | 2008-03-29 19:02:20 +0000 |
---|---|---|
committer | Sven Neumann <neo@src.gnome.org> | 2008-03-29 19:02:20 +0000 |
commit | f5653e2502792657ee67120bedb69d6d3387a3da (patch) | |
tree | 19d1ae21f6acbf51694b43a910839941c3c852fc /babl/babl-component.c | |
parent | 6787db98f6005fa5cdb31a9413a6dd58b2a0a00a (diff) |
babl/babl-component.c babl/babl-conversion.c babl/babl-db.c
2008-03-29 Sven Neumann <sven@gimp.org>
* babl/babl-component.c
* babl/babl-conversion.c
* babl/babl-db.c
* babl/babl-extension.c
* babl/babl-fish-path.c
* babl/babl-fish-reference.c
* babl/babl-fish-simple.c
* babl/babl-format.c
* babl/babl-model.c
* babl/babl-type.c: applied patch from Jan Heller that changes
the
code to test for a pre-existent instance of a babl class in the
database before creating a new one.
svn path=/trunk/; revision=298
Diffstat (limited to 'babl/babl-component.c')
-rw-r--r-- | babl/babl-component.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/babl/babl-component.c b/babl/babl-component.c index 84562cc..ef28dc6 100644 --- a/babl/babl-component.c +++ b/babl/babl-component.c @@ -109,14 +109,22 @@ babl_component_new (void *first_arg, va_end (varg); + babl = babl_db_exist (db, id, first_arg); + if (babl) + { + /* There is an instance already registered by the required id/name, + * returning the preexistent one instead. + */ + return babl; + } + babl = component_new (first_arg, id, luma, chroma, alpha); - { - Babl *ret = babl_db_insert (db, babl); - if (ret != babl) - babl_free (babl); - return ret; - } + /* Since there is not an already registered instance by the required + * id/name, inserting newly created class into database. + */ + babl_db_insert (db, babl); + return babl; } BABL_CLASS_TEMPLATE (component) |