manoj 99/04/08 20:43:28
Modified: pthreads/src/main alloc.c
Log:
An attempt to fix Roy's problems with ALLOC_DEBUG. The server will also
compile with POOL_DEBUG now.
Revision Changes Path
1.5 +14 -4 apache-apr/pthreads/src/main/alloc.c
Index: alloc.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/alloc.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- alloc.c 1999/03/17 17:01:16 1.4
+++ alloc.c 1999/04/09 03:43:28 1.5
@@ -159,6 +159,10 @@
union block_hdr *global_next;
struct pool *owning_pool;
#endif
+#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC)
+ unsigned is_free;
+#endif
+
} h;
};
@@ -284,14 +288,14 @@
#define reset_block(b) do { \
test_is_free(b); \
(b)->h.first_avail = (char *) ((b) + 1);\
- debug_fill((b)->h.first_avail, b(b)->h.endp - (b)->h.first_avail); \
+ debug_fill((b)->h.first_avail, (b)->h.endp - (b)->h.first_avail); \
(b)->h.owning_pool = FREE_POOL; \
} while(0)
#else
#define reset_block(b) do { \
test_is_free(b); \
(b)->h.first_avail = (char *) ((b) + 1);\
- debug_fill((b)->h.first_avail, b(b)->h.endp - (b)->h.first_avail); \
+ debug_fill((b)->h.first_avail, (b)->h.endp - (b)->h.first_avail); \
} while(0)
#endif
@@ -359,6 +363,9 @@
blok->h.next = NULL;
debug_verify_filled(blok->h.first_avail, blok->h.endp,
"Ouch! Someone trounced a block on the free list!\n");
+#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC)
+ blok->h.is_free = 0;
+#endif
return blok;
}
else {
@@ -371,6 +378,9 @@
min_size += BLOCK_MINFREE;
blok = malloc_block((min_size > BLOCK_MINALLOC) ? min_size :
BLOCK_MINALLOC);
+#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC)
+ blok->h.is_free = 0;
+#endif
return blok;
}
@@ -431,7 +441,7 @@
new_pool = (root_pool *) blok->h.first_avail;
blok->h.first_avail += ROOT_HDR_BYTES;
#ifdef POOL_DEBUG
- blok->h.owning_pool = new_pool;
+ blok->h.owning_pool = &(new_pool->p);
#endif
memset(new_pool, 0, sizeof(*new_pool));
@@ -931,7 +941,7 @@
ps.blok->h.owning_pool = p;
#endif
#if defined(ALLOC_DEBUG) && !defined(ALLOC_USE_MALLOC)
- ps.blok->is_free = 0;
+ ps.blok->h.is_free = 0;
#endif
}