Browse code

libclamav/matcher-bm.c: micro-optimization

Tomasz Kojm authored on 2009/08/20 07:35:22
Showing 2 changed files
... ...
@@ -1,3 +1,7 @@
1
+Thu Aug 20 00:34:39 CEST 2009 (tk)
2
+----------------------------------
3
+ * libclamav/matcher-bm.c: micro-optimization
4
+
1 5
 Tue Aug 18 23:52:20 CEST 2009 (tk)
2 6
 ----------------------------------
3 7
  * libclamav/cpio.c: wrap unistd.h, reported by Nigel Horne
... ...
@@ -178,6 +178,10 @@ int cli_bm_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
178 178
 	if(shift == 0) {
179 179
 	    prefix = buffer[i - BM_MIN_LENGTH + BM_BLOCK_SIZE];
180 180
 	    p = root->bm_suffix[idx];
181
+	    if(p && p->cnt == 1 && p->pattern0 != prefix) {
182
+		i++;
183
+		continue;
184
+	    }
181 185
 	    pchain = 0;
182 186
 	    while(p) {
183 187
 		if(p->pattern0 != prefix) {