Annotation of parser3/src/targets/cgi/pa_pool.C, revision 1.37

1.4       paf         1: /** @file
                      2:        Parser: CGI memory manager impl.
                      3: 
1.35      paf         4:        Copyright (c) 2001, 2002 ArtLebedev Group (http://www.artlebedev.com)
1.36      paf         5:        Author: Alexandr Petrosian <paf@design.ru> (http://paf.design.ru)
1.4       paf         6: 
1.37    ! paf         7:        $Id: pa_pool.C,v 1.36 2002/02/08 08:30:17 paf Exp $
1.1       paf         8: */
                      9: 
                     10: #include "pa_pool.h"
1.24      parser     11: #include "pool_storage.h"
1.1       paf        12: 
1.37    ! paf        13: #define DEBUG_STRING_APPENDS_VS_EXPANDS
        !            14: 
        !            15: #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
        !            16: unsigned long total_alloc_size=0;
        !            17: #endif
        !            18: 
1.25      paf        19: void *Pool::real_malloc(size_t size, int place) {
1.37    ! paf        20: #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
        !            21:        total_alloc_size+=size;
        !            22: #endif
        !            23: 
1.33      paf        24:        return fstorage?
                     25:                static_cast<Pool_storage *>(fstorage)->malloc(size): ::malloc(size);
1.1       paf        26: }
                     27: 
                     28: void *Pool::real_calloc(size_t size) {
1.37    ! paf        29: #ifdef DEBUG_STRING_APPENDS_VS_EXPANDS
        !            30:        total_alloc_size+=size;
        !            31: #endif
        !            32: 
1.33      paf        33:        return fstorage?
                     34:                static_cast<Pool_storage *>(fstorage)->calloc(size): ::calloc(size, 1);
1.1       paf        35: }
1.18      parser     36: 
1.20      parser     37: bool Pool::real_register_cleanup(void (*cleanup) (void *), void *data) {
1.24      parser     38:        return fstorage!=0 && static_cast<Pool_storage *>(fstorage)->register_cleanup(cleanup, data);
1.34      paf        39: }

E-mail: