Merge branch 'gnu-likely' into 2.0
This commit is contained in:
commit
7e08440d0c
1 changed files with 13 additions and 5 deletions
12
src/node.c
12
src/node.c
|
@ -13,6 +13,13 @@
|
|||
#include "slug.h"
|
||||
#include "zmalloc.h"
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define likely(x) __builtin_expect(!!(x), 1)
|
||||
# define unlikely(x) __builtin_expect(!!(x), 0)
|
||||
#else
|
||||
# define likely(x) !!(x)
|
||||
# define unlikely(x) !!(x)
|
||||
#endif
|
||||
|
||||
#define CHECK_PTR(ptr) if (ptr == NULL) return NULL;
|
||||
|
||||
|
@ -440,10 +447,11 @@ route * r3_tree_match_route(const node *tree, match_entry * entry) {
|
|||
}
|
||||
|
||||
inline edge * r3_node_find_edge_str(const node * n, const char * str, int str_len) {
|
||||
char firstbyte = *str;
|
||||
edge * e;
|
||||
unsigned int i;
|
||||
char firstbyte = *str;
|
||||
for (i = n->edge_len; i--; ) {
|
||||
edge *e = &n->edges[i];
|
||||
e = &n->edges[i];
|
||||
if (firstbyte == e->pattern[0]) {
|
||||
if (strncmp(e->pattern, str, e->pattern_len) == 0) {
|
||||
return &n->edges[i];
|
||||
|
|
Loading…
Reference in a new issue