summaryrefslogtreecommitdiffstats
path: root/libnetdata/inlined.h
diff options
context:
space:
mode:
authorthiagoftsm <49162938+thiagoftsm@users.noreply.github.com>2019-06-06 17:01:39 +0000
committerGitHub <noreply@github.com>2019-06-06 17:01:39 +0000
commit58b7d95a7ec9c576f8a06bbab07f755846b5349a (patch)
treef17e30963170e818bbe55ed32843eea71de7ac29 /libnetdata/inlined.h
parent7039044be96ee82058768d98865b992b100a294a (diff)
New URL parser (#6070)
* URL_parser 3 * URL_parser rebase 2! * URL_parameter parsing 3 * URL_parameter parsing 4 * URL_parameter parsing 5 * URL_parser alarms * URL_parser finish the basic structure * URL_parser codacity fixes! * URL_parser scripts! * URL_parser codacy! * URL_parser rebase 3! * URL_parser host fixes! * URL_parser host fixes 2! * URL_parser fix spaces! * URL_parser error message! * URL_parser Christopher requests! * URL_parser alarms fixed! * URL_parser health fixed! * URL_parser rebase 4! * URL_parser C fix write format! * URL_parser fix bugs due cache!
Diffstat (limited to 'libnetdata/inlined.h')
-rw-r--r--libnetdata/inlined.h28
1 files changed, 28 insertions, 0 deletions
diff --git a/libnetdata/inlined.h b/libnetdata/inlined.h
index 6a5994c12a..a9c3e472e4 100644
--- a/libnetdata/inlined.h
+++ b/libnetdata/inlined.h
@@ -31,6 +31,19 @@ static inline uint32_t simple_hash(const char *name) {
return hval;
}
+static inline uint32_t simple_nhash(const char *name,size_t len) {
+ unsigned char *s = (unsigned char *) name;
+ size_t i;
+ uint32_t hval = 0x811c9dc5;
+ i = 0;
+ do {
+ hval *= 16777619;
+ hval ^= (uint32_t) *s++;
+ } while (++i < len);
+
+ return hval;
+}
+
static inline uint32_t simple_uhash(const char *name) {
unsigned char *s = (unsigned char *) name;
uint32_t hval = 0x811c9dc5, c;
@@ -42,6 +55,21 @@ static inline uint32_t simple_uhash(const char *name) {
return hval;
}
+static inline uint32_t simple_nuhash(const char *name,size_t len) {
+ unsigned char *s = (unsigned char *) name;
+ size_t i;
+ uint32_t hval = 0x811c9dc5, c;
+
+ i = 0;
+ do {
+ c = *s++;
+ if (unlikely(c >= 'A' && c <= 'Z')) c += 'a' - 'A';
+ hval *= 16777619;
+ hval ^= c;
+ } while ( ++i < len);
+ return hval;
+}
+
static inline int simple_hash_strcmp(const char *name, const char *b, uint32_t *hash) {
unsigned char *s = (unsigned char *) name;
uint32_t hval = 0x811c9dc5;