apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stri...@apache.org
Subject cvs commit: apr/memory/unix apr_pools.c
Date Sun, 13 Jan 2002 18:46:24 GMT
striker     02/01/13 10:46:24

  Modified:    include  apr_pools.h
               memory/unix apr_pools.c
  Log:
  Supply a default tag in debug mode.  The tag is the location where
  the pool was created.
  
  Revision  Changes    Path
  1.70      +13 -9     apr/include/apr_pools.h
  
  Index: apr_pools.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_pools.h,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- apr_pools.h	13 Jan 2002 02:12:24 -0000	1.69
  +++ apr_pools.h	13 Jan 2002 18:46:24 -0000	1.70
  @@ -100,6 +100,11 @@
   #if defined(APR_POOL_DEBUG_VERBOSE) && !defined(APR_POOL_DEBUG)
   #define APR_POOL_DEBUG
   #endif    
  +
  +#define APR_POOL_STRINGIZE(x) APR_POOL__STRINGIZE(x)
  +#define APR_POOL__STRINGIZE(x) #x
  +#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_POOL_STRINGIZE(__LINE__)
  +    
       
   /** The fundamental pool type */
   typedef struct apr_pool_t apr_pool_t;
  @@ -161,14 +166,13 @@
   #if defined(APR_POOL_DEBUG)
   #define apr_pool_create_ex(newpool, parent, abort_fn, flag)  \
       apr_pool_create_ex_debug(newpool, parent, abort_fn, flag, \
  -                             __FILE__, __LINE__)
  +                             APR_POOL__FILE_LINE__)
   
   APR_DECLARE(apr_status_t) apr_pool_create_ex_debug(apr_pool_t **newpool,
                                                      apr_pool_t *parent,
                                                      apr_abortfunc_t abort_fn,
                                                      apr_uint32_t flags,
  -                                                   const char *file,
  -                                                   int line);
  +                                                   const char *file_line);
   #else
   APR_DECLARE(apr_status_t) apr_pool_create_ex(apr_pool_t **newpool,
                                                apr_pool_t *parent,
  @@ -191,7 +195,7 @@
   #if defined(APR_POOL_DEBUG)
   #define apr_pool_create(newpool, parent) \
       apr_pool_create_ex_debug(newpool, parent, NULL, APR_POOL_FDEFAULT, \
  -                             __FILE__, __LINE__)
  +                             APR_POOL__FILE_LINE__)
   #else
   #define apr_pool_create(newpool, parent) \
       apr_pool_create_ex(newpool, parent, NULL, APR_POOL_FDEFAULT)
  @@ -215,7 +219,7 @@
   #define apr_pool_sub_make(newpool, parent, abort_fn) \
       (void)apr_pool_create_ex_debug(newpool, parent, abort_fn, \
                                      APR_POOL_FDEFAULT, \
  -                                   __FILE__, __LINE__)
  +                                   APR_POOL__FILE_LINE__)
   #else
   #define apr_pool_sub_make(newpool, parent, abort_fn) \
       (void)apr_pool_create_ex(newpool, parent, abort_fn, APR_POOL_FDEFAULT)
  @@ -232,10 +236,10 @@
    */
   #if defined(APR_POOL_DEBUG)
   #define apr_pool_clear(p) \
  -    apr_pool_clear_debug(p, __FILE__, __LINE__)
  +    apr_pool_clear_debug(p, APR_POOL__FILE_LINE__)
   
   APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *p,
  -                                       const char *file, int line);
  +                                       const char *file_line);
   #else
   APR_DECLARE(void) apr_pool_clear(apr_pool_t *p);
   #endif
  @@ -248,10 +252,10 @@
    */
   #if defined(APR_POOL_DEBUG)
   #define apr_pool_destroy(p) \
  -    apr_pool_destroy_debug(p, __FILE__, __LINE__)
  +    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
   
   APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *p,
  -                                         const char *file, int line);
  +                                         const char *file_line);
   #else
   APR_DECLARE(void) apr_pool_destroy(apr_pool_t *p);
   #endif
  
  
  
  1.131     +19 -22    apr/memory/unix/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- apr_pools.c	13 Jan 2002 02:12:24 -0000	1.130
  +++ apr_pools.c	13 Jan 2002 18:46:24 -0000	1.131
  @@ -161,8 +161,7 @@
   
   #else /* !defined(APR_POOL_DEBUG) */
       debug_node_t         *nodes;
  -    const char           *file;
  -    int                   line;
  +    const char           *file_line;
       unsigned int          stat_alloc;
       unsigned int          stat_total_alloc;
       unsigned int          stat_clear;
  @@ -987,7 +986,7 @@
    * Pool creation/destruction (debug)
    */
   
  -static void pool_clear_debug(apr_pool_t *pool, const char *file, int line)
  +static void pool_clear_debug(apr_pool_t *pool, const char *file_line)
   {
       debug_node_t *node;
       apr_uint32_t index;
  @@ -996,7 +995,7 @@
        * this pool thus this loop is safe and easy.
        */
       while (pool->child)
  -        apr_pool_destroy_debug(pool->child, file, line);
  +        apr_pool_destroy_debug(pool->child, file_line);
   
       /* Run cleanups */
       run_cleanups(pool->cleanups);
  @@ -1024,45 +1023,45 @@
   }
   
   APR_DECLARE(void) apr_pool_clear_debug(apr_pool_t *pool, 
  -                                       const char *file, int line)
  +                                       const char *file_line)
   {
       check_integrity(pool);
       
   #if defined(APR_POOL_DEBUG_VERBOSE)
       if (file_stderr) {
           apr_file_printf(file_stderr,
  -            "POOL DEBUG: CLEAR  [%10lu/%10lu/%10lu] 0x%08X \"%s\" [%s:%d] (%u/%u/%u)\n",
  +            "POOL DEBUG: CLEAR  [%10lu/%10lu/%10lu] 0x%08X \"%s\" [%s] (%u/%u/%u)\n",
               (unsigned long)apr_pool_num_bytes(pool, 0),
               (unsigned long)apr_pool_num_bytes(pool, 1),
               (unsigned long)apr_pool_num_bytes(global_pool, 1),
               (unsigned int)pool, pool->tag,
  -            file, line,
  +            file_line,
               pool->stat_alloc, pool->stat_total_alloc, pool->stat_clear);
       }
   #endif
   
  -    pool_clear_debug(pool, file, line);
  +    pool_clear_debug(pool, file_line);
   }
   
   APR_DECLARE(void) apr_pool_destroy_debug(apr_pool_t *pool, 
  -                                         const char *file, int line)
  +                                         const char *file_line)
   {
       check_integrity(pool);
       
   #if defined(APR_POOL_DEBUG_VERBOSE)
       if (file_stderr) {
           apr_file_printf(file_stderr,
  -            "POOL DEBUG: DESTROY [%10lu/%10lu/%10lu] 0x%08X \"%s\" [%s:%d] (%u/%u/%u)\n",
  +            "POOL DEBUG: DESTROY [%10lu/%10lu/%10lu] 0x%08X \"%s\" [%s] (%u/%u/%u)\n",
               (unsigned long)apr_pool_num_bytes(pool, 0),
               (unsigned long)apr_pool_num_bytes(pool, 1),
               (unsigned long)apr_pool_num_bytes(global_pool, 1),
               (unsigned int)pool, pool->tag,
  -            file, line,
  +            file_line,
               pool->stat_alloc, pool->stat_total_alloc, pool->stat_clear);
       }
   #endif
   
  -    pool_clear_debug(pool, file, line);
  +    pool_clear_debug(pool, file_line);
   
       /* Remove the pool from the parents child list */
       if (pool->parent) {
  @@ -1090,8 +1089,7 @@
                                                      apr_pool_t *parent,
                                                      apr_abortfunc_t abort_fn,
                                                      apr_uint32_t flags, 
  -                                                   const char *file,
  -                                                   int line)
  +                                                   const char *file_line)
   {
       apr_pool_t *pool;
   
  @@ -1115,9 +1113,8 @@
       memset(pool, 0, SIZEOF_POOL_T);
       
       pool->abort_fn = abort_fn;
  -    pool->tag = "<untagged>";
  -    pool->file = file;
  -    pool->line = line;
  +    pool->tag = file_line;
  +    pool->file_line = file_line;
   
       if ((flags & APR_POOL_FNEW_ALLOCATOR) == APR_POOL_FNEW_ALLOCATOR) {
   #if APR_HAS_THREADS
  @@ -1165,12 +1162,12 @@
   #if defined(APR_POOL_DEBUG_VERBOSE)
       if (file_stderr) {
           apr_file_printf(file_stderr,
  -            "POOL DEBUG: CREATE  [%10lu/%10lu/%10lu] 0x%08X \"%s\" [%s:%u] parent: 0x%08X
\"%s\"\n",
  +            "POOL DEBUG: CREATE  [%10lu/%10lu/%10lu] 0x%08X \"%s\" [%s] parent: 0x%08X
\"%s\"\n",
               (unsigned long)0,
               (unsigned long)0,
               (unsigned long)apr_pool_num_bytes(global_pool, 1),
               (unsigned int)pool, pool->tag, 
  -            file, line,
  +            file_line,
               (unsigned int)parent, parent ? parent->tag : "<null>");
       }
   #endif
  @@ -1190,7 +1187,7 @@
   
   APR_DECLARE(void) apr_pool_clear(apr_pool_t *pool)
   {
  -    apr_pool_clear_debug(pool, "<undefined>", 0);
  +    apr_pool_clear_debug(pool, "<undefined>");
   }
   
   #undef apr_pool_destroy
  @@ -1198,7 +1195,7 @@
   
   APR_DECLARE(void) apr_pool_destroy(apr_pool_t *pool)
   {
  -    apr_pool_destroy_debug(pool, "<undefined>", 0);
  +    apr_pool_destroy_debug(pool, "<undefined>");
   }
   
   #undef apr_pool_create_ex
  @@ -1214,7 +1211,7 @@
   {
       return apr_pool_create_ex_debug(newpool, parent, 
                                       abort_fn, flags,
  -                                    "<undefined>", 0);
  +                                    "<undefined>");
   }
   
   
  
  
  

Mime
View raw message