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

Török Edvin edwin at clamav.net
Sun Apr 4 01:26:59 UTC 2010


The following commit has been merged in the debian/unstable branch:
commit 15fd260a835586dd0ea338e1297a60195ec58a12
Author: Török Edvin <edwin at clamav.net>
Date:   Sun Mar 28 23:46:41 2010 +0300

    Only show all the trace/debug messages in --enable-debug mode.
    
    This speeds up build of bytecode_vm.c, and makes the binary smaller.

diff --git a/libclamav/bytecode_vm.c b/libclamav/bytecode_vm.c
index c65fb9a..3dca85d 100644
--- a/libclamav/bytecode_vm.c
+++ b/libclamav/bytecode_vm.c
@@ -34,19 +34,23 @@
 #endif
 
 /* Enable this to catch more bugs in the RC phase */
-#define CL_BYTECODE_DEBUG
+#define CL_BYTECODE_SAFE
 
+
+#ifdef CL_BYTECODE_SAFE
 /* These checks will also be done by the bytecode verifier, but for
  * debugging purposes we have explicit checks, these should never fail! */
-#ifdef CL_BYTECODE_DEBUG
+#ifdef CL_DEBUG
 static int never_inline bcfail(const char *msg, long a, long b,
 		  const char *file, unsigned line)
 {
     cli_warnmsg("bytecode: check failed %s (%lx and %lx) at %s:%u\n", msg, a, b, file, line);
     return CL_EARG;
 }
+#else
+#define bcfail(msg,a,b,f,l) CL_EBYTECODE
+#endif
 
-#define CHECK_UNREACHABLE do { cli_dbgmsg("bytecode: unreachable executed!\n"); return CL_EBYTECODE; } while(0)
 #define CHECK_FUNCID(funcid) do { if (funcid >= bc->num_func) return \
     bcfail("funcid out of bounds!",funcid, bc->num_func,__FILE__,__LINE__); } while(0)
 #define CHECK_APIID(funcid) do { if (funcid >= cli_apicall_maxapi) return \
@@ -55,22 +59,28 @@ static int never_inline bcfail(const char *msg, long a, long b,
     bcfail("Values "#a" and "#b" don't match!",(a),(b),__FILE__,__LINE__); } while(0)
 #define CHECK_GT(a, b) do {if ((a) <= (b)) return \
     bcfail("Condition failed "#a" > "#b,(a),(b), __FILE__, __LINE__); } while(0)
-#define TRACE_R(x) cli_dbgmsg("bytecode trace: %u, read %llx\n", pc, (long long)x);
-#define TRACE_W(x, w, p) cli_dbgmsg("bytecode trace: %u, write%d @%u %llx\n", pc, p, w, (long long)(x));
-#define TRACE_EXEC(id, dest, ty, stack) cli_dbgmsg("bytecode trace: executing %d, -> %u (%u); %u\n", id, dest, ty, stack)
+
 #else
 static inline int bcfail(const char *msg, long a, long b,
 			 const char *file, unsigned line) {}
-#define TRACE_R(x)
-#define TRACE_W(x, w, p)
-#define TRACE_EXEC(id, dest, ty, stack)
-#define CHECK_UNREACHABLE return CL_EBYTECODE
 #define CHECK_FUNCID(x);
 #define CHECK_APIID(x);
 #define CHECK_EQ(a,b)
 #define CHECK_GT(a,b)
 #endif
 
+#ifdef CL_DEBUG
+#define CHECK_UNREACHABLE do { cli_dbgmsg("bytecode: unreachable executed!\n"); return CL_EBYTECODE; } while(0)
+#define TRACE_R(x) cli_dbgmsg("bytecode trace: %u, read %llx\n", pc, (long long)x);
+#define TRACE_W(x, w, p) cli_dbgmsg("bytecode trace: %u, write%d @%u %llx\n", pc, p, w, (long long)(x));
+#define TRACE_EXEC(id, dest, ty, stack) cli_dbgmsg("bytecode trace: executing %d, -> %u (%u); %u\n", id, dest, ty, stack)
+#else
+#define CHECK_UNREACHABLE return CL_EBYTECODE
+#define TRACE_R(x)
+#define TRACE_W(x, w, p)
+#define TRACE_EXEC(id, dest, ty, stack)
+#endif
+
 #define SIGNEXT(a, from) CLI_SRS(((int64_t)(a)) << (64-(from)), (64-(from)))
 
 #ifdef CL_DEBUG

-- 
Debian repository for ClamAV



More information about the Pkg-clamav-commits mailing list