You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by gr...@apache.org on 2017/01/12 15:35:51 UTC
[1/3] celix git commit: CELIX-391: Fix for utils_stringHash
Repository: celix
Updated Branches:
refs/heads/develop 2de5fb464 -> 34c94dae0
CELIX-391: Fix for utils_stringHash
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/3824cfc3
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/3824cfc3
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/3824cfc3
Branch: refs/heads/develop
Commit: 3824cfc3d5bc6fd0b20c284eed3164294ad5a92c
Parents: 147e8bf
Author: Roy Lenferink <le...@gmail.com>
Authored: Thu Jan 12 08:51:39 2017 +0100
Committer: Roy Lenferink <le...@gmail.com>
Committed: Thu Jan 12 08:51:39 2017 +0100
----------------------------------------------------------------------
utils/private/src/utils.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/3824cfc3/utils/private/src/utils.c
----------------------------------------------------------------------
diff --git a/utils/private/src/utils.c b/utils/private/src/utils.c
index a9ffd2c..fc4d538 100644
--- a/utils/private/src/utils.c
+++ b/utils/private/src/utils.c
@@ -30,14 +30,13 @@
unsigned int utils_stringHash(const void* strPtr) {
const char* string = strPtr;
- unsigned int hash = 5381;
- unsigned int i = 0;
- unsigned int len = strlen(string);
+ unsigned int hc = 5381;
+ char ch;
+ while((ch = *string++) != '\0'){
+ hc = (hc << 5) + hc + ch;
+ }
- for(i=0; i < len; i++)
- { hash = (hash << 5) + (*string) + hash; }
-
- return hash;
+ return hc;
}
int utils_stringEquals(const void* string, const void* toCompare) {
[3/3] celix git commit: CELIX-391: This closes #13
Posted by gr...@apache.org.
CELIX-391: This closes #13
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/34c94dae
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/34c94dae
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/34c94dae
Branch: refs/heads/develop
Commit: 34c94dae04a293310b6528b51de358d1a2357ce6
Parents: 18d362e
Author: gricciardi <gr...@apache.org>
Authored: Thu Jan 12 16:35:23 2017 +0100
Committer: gricciardi <gr...@apache.org>
Committed: Thu Jan 12 16:35:23 2017 +0100
----------------------------------------------------------------------
utils/private/test/utils_test.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/celix/blob/34c94dae/utils/private/test/utils_test.cpp
----------------------------------------------------------------------
diff --git a/utils/private/test/utils_test.cpp b/utils/private/test/utils_test.cpp
index 22b04b7..8f939c0 100644
--- a/utils/private/test/utils_test.cpp
+++ b/utils/private/test/utils_test.cpp
@@ -70,12 +70,12 @@ TEST(utils, stringHash) {
char * toHash = my_strdup("abc");
unsigned int hash;
hash = utils_stringHash((void *) toHash);
- LONGS_EQUAL(193485928, hash);
+ LONGS_EQUAL(193485963, hash);
free(toHash);
toHash = my_strdup("abc123def456ghi789jkl012mno345pqr678stu901vwx234yz");
hash = utils_stringHash((void *) toHash);
- LONGS_EQUAL(3704717399, hash);
+ LONGS_EQUAL(1532304168, hash);
free(toHash);
toHash = my_strdup("abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"
@@ -101,7 +101,7 @@ TEST(utils, stringHash) {
"abc123def456ghi789jkl012mno345pqr678stu901vwx234yz"
"abc123def456ghi789jkl012mno345pqr678stu901vwx234yz");
hash = utils_stringHash((void *) toHash);
- LONGS_EQUAL(3862509969, hash);
+ LONGS_EQUAL(3721605959, hash);
free(toHash);
}
[2/3] celix git commit: Merge branch 'develop' of
https://github.com/rlenferink/celix into develop
Posted by gr...@apache.org.
Merge branch 'develop' of https://github.com/rlenferink/celix into develop
Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/18d362e2
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/18d362e2
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/18d362e2
Branch: refs/heads/develop
Commit: 18d362e2d71fc580095ecd56f1a3b2f3154004e2
Parents: 2de5fb4 3824cfc
Author: gricciardi <gr...@apache.org>
Authored: Thu Jan 12 16:04:35 2017 +0100
Committer: gricciardi <gr...@apache.org>
Committed: Thu Jan 12 16:04:35 2017 +0100
----------------------------------------------------------------------
utils/private/src/utils.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
----------------------------------------------------------------------