diff --git a/src/http/header/get.c b/src/http/header/get.c index 4534263..81c24ba 100644 --- a/src/http/header/get.c +++ b/src/http/header/get.c @@ -33,21 +33,17 @@ inline int comp(const void * _a, const void * _b) { - HttpHeader a = (HttpHeader)_a; - HttpHeader b = (HttpHeader)_b; - return (a->hash < b->hash)? -1 : (a->hash > b->hash)? 1 : 0; + const unsigned long * a = _a; + HttpHeader b = (HttpHeader)_b; + return (*a < b->hash)? -1 : (*a > b->hash)? 1 : 0; } HttpHeader httpHeaderGet(const HttpHeader * root, const char * name, size_t nname) { - struct c_HttpHeader search = { - sdbm((const unsigned char*)name, nname), - NULL, - {}, - 0}; + unsigned long hash = sdbm((const unsigned char*)name, nname); - HttpHeader * found = tfind(&search, (void**)root, comp); + HttpHeader * found = tfind(&hash, (void**)root, comp); return (NULL != found)? *found : NULL; }