You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/dev-util/bdelta/files/bdelta-0.2.3-libbdelta-rena...

66 lines
1.9 KiB

From 3f2ac2dc56ed344dec1d2d38934682de2e326e49 Mon Sep 17 00:00:00 2001
From: Sergei Trofimovich <slyfox@gentoo.org>
Date: Wed, 7 Dec 2011 21:01:20 +0300
Subject: [PATCH 3/4] libbdelta: rename NDEBUG to DO_STATS_DEBUG
As it activates quite specific spam to stdout.
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
---
trunk/src/libbdelta.cpp | 11 +++++++----
1 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/trunk/src/libbdelta.cpp b/trunk/src/libbdelta.cpp
index 5808789..2a7e6e0 100644
--- a/trunk/src/libbdelta.cpp
+++ b/trunk/src/libbdelta.cpp
@@ -22,6 +22,9 @@ typedef uint16_t Token;
typedef uint32_t Token;
#endif
+// Enables delta chunk statistics
+// #define DO_STATS_DEBUG
+
#include <stdio.h>
#include <stdlib.h>
#include "container.h"
@@ -171,7 +174,7 @@ void sortTMatches(DLink<Match> *place, PotentialMatch *matches, unsigned numMatc
std::sort(matches, matches + numMatches, DistanceFromP1(lastf1Place));
}
-#ifndef NDEBUG
+#ifdef DO_STATS_DEBUG
long long stata = 0, statb = 0;
#endif
void findMatches(BDelta_Instance *b, Checksums_Instance *h, unsigned start, unsigned end,
@@ -200,7 +203,7 @@ void findMatches(BDelta_Instance *b, Checksums_Instance *h, unsigned start, unsi
// Keep the best 16
sortTMatches(place, pMatch, pMatchCount);
pMatchCount = 16;
-#ifndef NDEBUG
+#ifdef DO_STATS_DEBUG
++statb;
#endif
}
@@ -259,7 +262,7 @@ void findMatches(BDelta_Instance *b, Checksums_Instance *h, unsigned start, unsi
buf_loc = blocksize;
j += blocksize;
}
-#ifndef NDEBUG
+#ifdef DO_STATS_DEBUG
++stata;
#endif
break;
@@ -415,7 +418,7 @@ unsigned bdelta_pass(void *instance, unsigned blocksize) {
delete unused;
delete h.htable;
delete h.checksums;
-#ifndef NDEBUG
+#ifdef DO_STATS_DEBUG
printf("a = %.lli; b = %.lli\n", stata, statb);
#endif
// printf("Found %i matches\n", b->matches.size());
--
1.7.8