summaryrefslogtreecommitdiffstats
path: root/src/attributes.cpp
diff options
context:
space:
mode:
authorMarc Jeanmougin <marc@jeanmougin.fr>2015-12-09 15:49:59 +0000
committerMarc Jeanmougin <marcjeanmougin@free.fr>2015-12-09 15:49:59 +0000
commit50ab3a3c4215474d437f9adcc4b725bed26767d7 (patch)
tree0241555b1dc6efe9f35db7696c7e440e8a56bada /src/attributes.cpp
parentRemove unused var in header file (diff)
parentupdate to trunk (diff)
downloadinkscape-50ab3a3c4215474d437f9adcc4b725bed26767d7.tar.gz
inkscape-50ab3a3c4215474d437f9adcc4b725bed26767d7.zip
Merge glib_hunt: cppification and removal of many glib GList/GSList/GHashTable
(bzr r14520)
Diffstat (limited to 'src/attributes.cpp')
-rw-r--r--src/attributes.cpp20
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 *