File:  [parser3project] / parser3 / src / targets / cgi / Attic / pa_pool.C
Revision 1.41.2.1: download - view: text, annotated - select for diffs - revision graph
Fri Jan 31 12:34:40 2003 UTC (23 years, 5 months ago) by paf
Diff to: branchpoint 1.41: preferred, unified
grammar compiled

/** @file
	Parser: CGI memory manager impl.

	Copyright (c) 2001-2003 ArtLebedev Group (http://www.artlebedev.com)
	Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
*/

static const char* IDENT_POOL_C="$Date: 2003/01/31 12:34:40 $";

#include "pa_pool.h"
#include "pool_storage.h"

//#define DEBUG_STRING_APPENDS_VS_EXPANDS

#ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
unsigned long total_alloc_size=0;
#endif

void *Pool::real_malloc(size_t size, int place) {
#ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
	total_alloc_size+=size;
#endif

	return fstorage?
		static_cast<Pool_storage *>(fstorage)->malloc(size): ::malloc(size);
}

void *Pool::real_calloc(size_t size) {
#ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
	total_alloc_size+=size;
#endif

	return fstorage?
		static_cast<Pool_storage *>(fstorage)->calloc(size): ::calloc(size, 1);
}

bool Pool::real_register_cleanup(void (*cleanup) (void *), void *data) {
	return fstorage!=0 && static_cast<Pool_storage *>(fstorage)->register_cleanup(cleanup, data);
}

E-mail: