minor optimisation

git-svn: trunk@3251
This commit is contained in:
Tomasz Kojm 2007-09-26 22:18:44 +00:00
parent 126efa7c22
commit ecf5865b53
3 changed files with 15 additions and 2 deletions

View file

@ -1,3 +1,7 @@
Wed Sep 26 23:36:06 CEST 2007 (tk)
----------------------------------
* libclamav/matcher-ac.c: minor optimisation
Tue Sep 25 10:43:35 BST 2007 (njh)
----------------------------------
* libclamav/mbox.c: Only use strcasestr on Linux (for now, until it

View file

@ -331,6 +331,14 @@ void cli_ac_free(struct cli_matcher *root)
#define AC_MATCH_CHAR(p,b) \
switch(wc = p & CLI_MATCH_WILDCARD) { \
case CLI_MATCH_CHAR: \
if((unsigned char) p != b) \
return 0; \
break; \
\
case CLI_MATCH_IGNORE: \
break; \
\
case CLI_MATCH_ALTERNATIVE: \
found = 0; \
for(j = 0; j < pattern->altn[alt]; j++) { \
@ -355,8 +363,8 @@ void cli_ac_free(struct cli_matcher *root)
break; \
\
default: \
if(wc != CLI_MATCH_IGNORE && (unsigned char) p != b) \
return 0; \
cli_errmsg("ac_findmatch: Unknown wildcard 0x%x\n", wc); \
return 0; \
}
inline static int ac_findmatch(const unsigned char *buffer, uint32_t offset, uint32_t length, const struct cli_ac_patt *pattern)

View file

@ -32,6 +32,7 @@
#include "matcher-bm.h"
#define CLI_MATCH_WILDCARD 0xff00
#define CLI_MATCH_CHAR 0x0000
#define CLI_MATCH_IGNORE 0x0100
#define CLI_MATCH_ALTERNATIVE 0x0200
#define CLI_MATCH_NIBBLE_HIGH 0x0300