summaryrefslogtreecommitdiff
path: root/src/lib/eina/eina_hash.c
diff options
context:
space:
mode:
authorCedric Bail <cedric.bail@samsung.com>2013-12-04 19:05:03 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-12-04 19:05:03 +0900
commitff845b0a7c9bb6de48f5786a6a8a092d8819debf (patch)
tree07688d2e39dbcf0992caaa7994bc74c1023d35c3 /src/lib/eina/eina_hash.c
parent41c28c3deb33cce2b728c11f6a9f85ed62922f21 (diff)
eina: improve cmp function of eina_hash string related hash.
For strings, we already know the length, so let's just not call the heavy strcmp if the length is not already the same. Get some easy speedup here.
Diffstat (limited to '')
-rw-r--r--src/lib/eina/eina_hash.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/eina/eina_hash.c b/src/lib/eina/eina_hash.c
index 274d3e840c..4b060644af 100644
--- a/src/lib/eina/eina_hash.c
+++ b/src/lib/eina/eina_hash.c
@@ -489,9 +489,13 @@ _eina_string_key_length(const char *key)
489} 489}
490 490
491static int 491static int
492_eina_string_key_cmp(const char *key1, EINA_UNUSED int key1_length, 492_eina_string_key_cmp(const char *key1, int key1_length,
493 const char *key2, EINA_UNUSED int key2_length) 493 const char *key2, int key2_length)
494{ 494{
495 int delta;
496
497 delta = key1_length - key2_length;
498 if (delta) return delta;
495 return strcmp(key1, key2); 499 return strcmp(key1, key2);
496} 500}
497 501