summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f5f75c6)
raw | patch | inline | side by side (parent: f5f75c6)
author | Junio C Hamano <junkio@cox.net> | |
Mon, 30 Oct 2006 22:27:52 +0000 (14:27 -0800) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 30 Oct 2006 22:27:52 +0000 (14:27 -0800) |
When compiled for debugging, make sure that refcnt sanity check
code detects underflows in origin reference counting.
Signed-off-by: Junio C Hamano <junkio@cox.net>
code detects underflows in origin reference counting.
Signed-off-by: Junio C Hamano <junkio@cox.net>
builtin-pickaxe.c | patch | blob | history |
diff --git a/builtin-pickaxe.c b/builtin-pickaxe.c
index 3e7277da21cdf4c94a0056e1e9a404c383a5f6b8..82868328ac1fb6b951e2124db7a8563365fe34e3 100644 (file)
--- a/builtin-pickaxe.c
+++ b/builtin-pickaxe.c
if (!cmp_suspect(ent->suspect, suspect))
ent->guilty = 1;
origin_decref(suspect);
- coalesce(sb);
+
+ if (DEBUG) /* sanity */
+ sanity_check_refcnt(sb);
}
}
struct blame_entry *ent;
for (ent = sb->ent; ent; ent = ent->next) {
- /* first mark the ones that haven't been checked */
+ /* Nobody should have zero or negative refcnt */
+ if (ent->suspect->refcnt <= 0)
+ baa = 1;
+ }
+ for (ent = sb->ent; ent; ent = ent->next) {
+ /* Mark the ones that haven't been checked */
if (0 < ent->suspect->refcnt)
ent->suspect->refcnt = -ent->suspect->refcnt;
- else if (!ent->suspect->refcnt)
- baa = 1;
}
for (ent = sb->ent; ent; ent = ent->next) {
/* then pick each and see if they have the the
if (0 < suspect->refcnt)
continue;
- suspect->refcnt = -suspect->refcnt;
+ suspect->refcnt = -suspect->refcnt; /* Unmark */
for (found = 0, e = sb->ent; e; e = e->next) {
if (e->suspect != suspect)
continue;