diff options
| author | Marc Jeanmougin <marc@jeanmougin.fr> | 2015-12-09 00:45:44 +0000 |
|---|---|---|
| committer | Marc Jeanmougin <marcjeanmougin@free.fr> | 2015-12-09 00:45:44 +0000 |
| commit | 1c18349cc106bb55c7bca12fd572fb7b899ff225 (patch) | |
| tree | 68150ab0e7a637f7f7d3b3e97424c03827409570 /src/attributes.cpp | |
| parent | finally removed all GSList from main folder .h files (diff) | |
| download | inkscape-1c18349cc106bb55c7bca12fd572fb7b899ff225.tar.gz inkscape-1c18349cc106bb55c7bca12fd572fb7b899ff225.zip | |
replaced remaining GHashTable with std::map
(bzr r14504.1.16)
Diffstat (limited to 'src/attributes.cpp')
| -rw-r--r-- | src/attributes.cpp | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/attributes.cpp b/src/attributes.cpp index ad6a51c88..e8620a498 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -536,21 +536,13 @@ static SPStyleProp const props[] = { unsigned sp_attribute_lookup(gchar const *key) { - static GHashTable *propdict = NULL; - - if (!propdict) { - unsigned int i; - propdict = g_hash_table_new(g_str_hash, g_str_equal); - for (i = 1; i < n_attrs; i++) { - g_assert(props[i].code == static_cast< gint >(i) ); - // If this g_assert fails, then the sort order of SPAttributeEnum does not match the order in props[]! - g_hash_table_insert(propdict, - const_cast<void *>(static_cast<void const *>(props[i].name)), - GINT_TO_POINTER(props[i].code)); - } + for (unsigned int i = 1; i < n_attrs; i++) { + g_assert(props[i].code == static_cast< gint >(i) ); + // If this g_assert fails, then the sort order of SPAttributeEnum does not match the order in props[]! + if(g_str_equal(const_cast<void *>(static_cast<void const *>(props[i].name)), key)) + return GPOINTER_TO_UINT(GINT_TO_POINTER(props[i].code)); } - - return GPOINTER_TO_UINT(g_hash_table_lookup(propdict, key)); + return SP_ATTR_INVALID; } unsigned char const * |
