[Pkg-clamav-commits] [SCM] Debian repository for ClamAV branch, debian/unstable, updated. debian/0.95+dfsg-1-167-g4319a8f

tkojm tkojm at 77e5149b-7576-45b1-b177-96237e5ba77b
Fri Jun 12 19:10:57 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit aa1d9e83addb6d570c6ea609d3cad5c5d1ed327c
Author: tkojm <tkojm at 77e5149b-7576-45b1-b177-96237e5ba77b>
Date:   Fri Apr 10 12:01:57 2009 +0000

    libclamav/matcher-bm.c: minor performance improvement (bb#1539)
    
    
    git-svn-id: http://svn.clamav.net/svn/clamav-devel/trunk@5034 77e5149b-7576-45b1-b177-96237e5ba77b

diff --git a/ChangeLog b/ChangeLog
index b06cfa6..50dd810 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Apr 10 14:01:01 CEST 2009 (tk)
+----------------------------------
+ * libclamav/matcher-bm.c: minor performance improvement (bb#1539)
+			   Thanks to Edwin
+
 Wed Apr  8 16:49:32 CEST 2009 (tk)
 ----------------------------------
  * V 0.95.1
diff --git a/libclamav/matcher-bm.c b/libclamav/matcher-bm.c
index 5d5c1d0..5f833d4 100644
--- a/libclamav/matcher-bm.c
+++ b/libclamav/matcher-bm.c
@@ -74,7 +74,7 @@ int cli_bm_addpatt(struct cli_matcher *root, struct cli_bm_patt *pattern)
 
     prev = next = root->bm_suffix[idx];
     while(next) {
-	if(pt[0] >= next->pattern[0])
+	if(pt[0] >= next->pattern0)
 	    break;
 	prev = next;
 	next = next->next;
@@ -89,6 +89,7 @@ int cli_bm_addpatt(struct cli_matcher *root, struct cli_bm_patt *pattern)
 	pattern->next = prev->next;
 	prev->next = pattern;
     }
+    pattern->pattern0 = pattern->pattern[0];
     root->bm_suffix[idx]->cnt++;
 
     root->bm_patterns++;
@@ -173,7 +174,7 @@ int cli_bm_scanbuff(const unsigned char *buffer, uint32_t length, const char **v
 	    p = root->bm_suffix[idx];
 	    pchain = 0;
 	    while(p) {
-		if(p->pattern[0] != prefix) {
+		if(p->pattern0 != prefix) {
 		    if(pchain)
 			break;
 		    p = p->next;
diff --git a/libclamav/matcher-bm.h b/libclamav/matcher-bm.h
index e23554b..0deff45 100644
--- a/libclamav/matcher-bm.h
+++ b/libclamav/matcher-bm.h
@@ -31,6 +31,7 @@ struct cli_bm_patt {
     struct cli_bm_patt *next;
     uint16_t length, prefix_length;
     uint16_t cnt;
+    unsigned char pattern0;
     uint8_t target;
 };
 

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list