Showing
1 changed file
with
5 additions
and
9 deletions
| ... | ... | @@ -33,21 +33,17 @@ inline |
| 33 | 33 | int |
| 34 | 34 | comp(const void * _a, const void * _b) |
| 35 | 35 | { |
| 36 | - HttpHeader a = (HttpHeader)_a; | |
| 37 | - HttpHeader b = (HttpHeader)_b; | |
| 38 | - return (a->hash < b->hash)? -1 : (a->hash > b->hash)? 1 : 0; | |
| 36 | + const unsigned long * a = _a; | |
| 37 | + HttpHeader b = (HttpHeader)_b; | |
| 38 | + return (*a < b->hash)? -1 : (*a > b->hash)? 1 : 0; | |
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | HttpHeader |
| 42 | 42 | httpHeaderGet(const HttpHeader * root, const char * name, size_t nname) |
| 43 | 43 | { |
| 44 | - struct c_HttpHeader search = { | |
| 45 | - sdbm((const unsigned char*)name, nname), | |
| 46 | - NULL, | |
| 47 | - {}, | |
| 48 | - 0}; | |
| 44 | + unsigned long hash = sdbm((const unsigned char*)name, nname); | |
| 49 | 45 | |
| 50 | - HttpHeader * found = tfind(&search, (void**)root, comp); | |
| 46 | + HttpHeader * found = tfind(&hash, (void**)root, comp); | |
| 51 | 47 | |
| 52 | 48 | return (NULL != found)? *found : NULL; |
| 53 | 49 | } | ... | ... |
Please
register
or
login
to post a comment