From: Andi Gutmans Date: Sun, 16 Jun 2002 17:20:15 +0000 (+0000) Subject: - Remove debug code which doesn't work anymore and add headers. X-Git-Tag: php-4.3.0dev_zend2_alpha2~242 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=24e59ba35b7b12df61c069390006c3baf1c9a993;p=php - Remove debug code which doesn't work anymore and add headers. --- diff --git a/Zend/zend_mm.c b/Zend/zend_mm.c index 17d8c5f167..2d93cdbf37 100644 --- a/Zend/zend_mm.c +++ b/Zend/zend_mm.c @@ -1,3 +1,22 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + #include #include "zend_mm.h" @@ -223,98 +242,3 @@ void *zend_mm_realloc(zend_mm_heap *heap, void *p, size_t size) zend_mm_free(heap, p); return ptr; } - -/* Debug functions & Test */ -#if 0 - -int zend_mm_num_blocks() -{ - zend_mm_block *mm_block=free_list; - int i=0; - - while (mm_block) { - i++; - mm_block = mm_block->next_free_block; - } - return i; -} - - -static void zend_mm_display_blocks(char *str) -{ -#if 0 - int i=0; - zend_mm_block *mm_block; - zend_mm_block *end_block=NULL; - - printf("%s: free_list -> ", str); - for (mm_block=free_list; mm_block; mm_block=mm_block->next_free_block) { - // printf("0x%0.8X -> ", mm_block); - printf("%d -> ", mm_block->size); - end_block = mm_block; - } - printf("NULL\n"); - - printf("%s: ", str); - for (mm_block=end_block; mm_block; mm_block=mm_block->prev_free_block) { - printf("0x%0.8X -> ", mm_block); - } - printf("NULL\n"); -#endif -} - - -#define NUM_CHUNKS 5 -#define CHUNK_SIZE 1048576 -#define ALLOCS 100 - -int main() -{ - void *chunks[NUM_CHUNKS]; - size_t chunk_sizes[NUM_CHUNKS]; - int i, j; - void *p[ALLOCS]; - size_t allocated_sizes[ALLOCS]; - int num_blocks=0; - int size_allocated; - - srand(time(NULL)); - for (i=0; i0) { - i = rand()%ALLOCS; - if (p[i]) { -// printf("Freeing block %d: %d bytes - 0x%0.8X\n", i, allocated_sizes[i], p[i]); - zend_mm_free(p[i]); - p[i] = NULL; - num_blocks--; - } - } - zend_mm_num_blocks("After freeing"); - } - - return 0; -} - -#endif diff --git a/Zend/zend_mm.h b/Zend/zend_mm.h index 591402d998..c4aa6f5790 100644 --- a/Zend/zend_mm.h +++ b/Zend/zend_mm.h @@ -1,3 +1,22 @@ +/* + +----------------------------------------------------------------------+ + | Zend Engine | + +----------------------------------------------------------------------+ + | Copyright (c) 1998-2002 Zend Technologies Ltd. (http://www.zend.com) | + +----------------------------------------------------------------------+ + | This source file is subject to version 2.00 of the Zend license, | + | that is bundled with this package in the file LICENSE, and is | + | available at through the world-wide-web at | + | http://www.zend.com/license/2_00.txt. | + | If you did not receive a copy of the Zend license and are unable to | + | obtain it through the world-wide-web, please send a note to | + | license@zend.com so we can mail you a copy immediately. | + +----------------------------------------------------------------------+ + | Authors: Andi Gutmans | + | Zeev Suraski | + +----------------------------------------------------------------------+ +*/ + #ifndef _ZEND_MM_H #define _ZEND_MM_H