Browse code

matcher-ac: optimize the not-taken case

This generates more efficient code for the trie traversing loop,
using registers instead of stack locations for the variables.

Török Edwin authored on 2011/04/12 03:27:04
Showing 1 changed files
... ...
@@ -1169,7 +1169,7 @@ int cli_ac_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
1169 1169
     for(i = 0; i < length; i++)  {
1170 1170
 	current = current->trans[buffer[i]];
1171 1171
 
1172
-	if(IS_FINAL(current)) {
1172
+	if(UNLIKELY(IS_FINAL(current))) {
1173 1173
 	    faillist = NULL;
1174 1174
 	    patt = current->list;
1175 1175
 	    if(IS_LEAF(current)) {