summaryrefslogtreecommitdiff
path: root/sal
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2013-01-14 15:13:50 +0100
committerStephan Bergmann <sbergman@redhat.com>2013-01-14 17:21:02 +0100
commit6bbe55c4f563bd6944d276760d7c30527136313b (patch)
treea82d9e54774f6e41afef1af1b914e26cf76e953b /sal
parent0dd3b8b24364d31a00ef30b70dcc6fb63c5d96c9 (diff)
Simplify code
Change-Id: Ib35cba4544726c1653d36072f3499dffec3cced3
Diffstat (limited to 'sal')
-rw-r--r--sal/rtl/source/locale.cxx41
1 files changed, 12 insertions, 29 deletions
diff --git a/sal/rtl/source/locale.cxx b/sal/rtl/source/locale.cxx
index e9b9e15aaca9..0c47b95cb3dc 100644
--- a/sal/rtl/source/locale.cxx
+++ b/sal/rtl/source/locale.cxx
@@ -121,37 +121,20 @@ extern "C" rtl_Locale* rtl_hashtable_add(RTL_HASHTABLE** table, rtl_Locale* valu
key = rtl_hashfunc(*table, value->HashCode);
- if (!(*table)->Table[key])
+ RTL_HASHENTRY **pEntry = &(*table)->Table[key];
+ while (*pEntry)
{
- RTL_HASHENTRY *newEntry = (RTL_HASHENTRY*)rtl_allocateMemory( sizeof(RTL_HASHENTRY) );
- newEntry->Entry = value;
- newEntry->Next = NULL;
- (*table)->Table[key] = newEntry;
- (*table)->Elements++;
- return NULL;
- } else
- {
- RTL_HASHENTRY *pEntry = (*table)->Table[key];
- RTL_HASHENTRY *newEntry = NULL;
-
- while (pEntry)
- {
- if (value->HashCode == pEntry->Entry->HashCode)
- return pEntry->Entry;
-
- if (!pEntry->Next)
- break;
-
- pEntry = pEntry->Next;
- }
-
- newEntry = (RTL_HASHENTRY*)rtl_allocateMemory( sizeof(RTL_HASHENTRY) );
- newEntry->Entry = value;
- newEntry->Next = NULL;
- pEntry->Next = newEntry;
- (*table)->Elements++;
- return NULL;
+ if (value->HashCode == (*pEntry)->Entry->HashCode)
+ return (*pEntry)->Entry;
+ pEntry = &(*pEntry)->Next;
}
+
+ RTL_HASHENTRY *newEntry = (RTL_HASHENTRY*)rtl_allocateMemory( sizeof(RTL_HASHENTRY) );
+ newEntry->Entry = value;
+ newEntry->Next = NULL;
+ *pEntry = newEntry;
+ (*table)->Elements++;
+ return NULL;
}
sal_Bool rtl_hashtable_grow(RTL_HASHTABLE** table)