From 1ca1574ddfbd928faeece98fa2a9fe3c32800e5c Mon Sep 17 00:00:00 2001
From: Arne Goedeke <el@laramies.com>
Date: Tue, 11 Feb 2014 11:24:19 +0100
Subject: [PATCH] block_allocator: do not execute empty loop

---
 src/block_allocator.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/block_allocator.c b/src/block_allocator.c
index 0ea4a1d646..271c12e376 100644
--- a/src/block_allocator.c
+++ b/src/block_allocator.c
@@ -508,19 +508,23 @@ struct ba_block_header * ba_sort_list(const struct ba_page * p,
 }
 
 static INLINE void ba_list_defined(struct block_allocator * a, struct ba_block_header * b) {
+#ifdef USE_VALGRIND
     while (b && b != BA_ONE) {
         PIKE_MEMPOOL_ALLOC(a, b, a->l.block_size);
         PIKE_MEM_RW_RANGE(b, sizeof(struct ba_block_header));
         b = b->next;
     }
+#endif
 }
 
 static INLINE void ba_list_undefined(struct block_allocator * a, struct ba_block_header * b) {
+#ifdef USE_VALGRIND
     while (b && b != BA_ONE) {
         struct ba_block_header * next = b->next;
         PIKE_MEMPOOL_FREE(a, b, a->l.block_size);
         b = next;
     }
+#endif
 }
 
 /*
-- 
GitLab