apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: apr/lib apr_pools.c
Date Fri, 05 Jan 2001 00:10:11 GMT
rbb         01/01/04 16:10:11

  Modified:    .        configure.in
               file_io/unix fileacc.c
               include  apr_file_io.h
               lib      apr_pools.c
  Log:
  We need to initialize have_corkable_tcp to 0, otherwise on platforms
  that can't cork, we get a syntax error when we check #if HAVE_CORKABLE_TCP,
  because HAVE_CORKABLE_TCP is empty
  
  Revision  Changes    Path
  1.201     +1 -0      apr/configure.in
  
  Index: configure.in
  ===================================================================
  RCS file: /home/cvs/apr/configure.in,v
  retrieving revision 1.200
  retrieving revision 1.201
  diff -u -r1.200 -r1.201
  --- configure.in	2001/01/04 22:02:26	1.200
  +++ configure.in	2001/01/05 00:10:09	1.201
  @@ -792,6 +792,7 @@
   AC_CHECK_DEFINE(TCP_CORK, netinet/tcp.h)
   AC_CHECK_DEFINE(TCP_NOPUSH, netinet/tcp.h)
   apr_tcp_nopush_flag="0"
  +have_corkable_tcp="0"
   if test "x$ac_cv_define_TCP_CORK" = "xyes"; then
       apr_tcp_nopush_flag="TCP_CORK"
       have_corkable_tcp="1"
  
  
  
  1.42      +3 -3      apr/file_io/unix/fileacc.c
  
  Index: fileacc.c
  ===================================================================
  RCS file: /home/cvs/apr/file_io/unix/fileacc.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- fileacc.c	2000/11/14 06:40:03	1.41
  +++ fileacc.c	2001/01/05 00:10:10	1.42
  @@ -57,7 +57,7 @@
   
   /* A file to put ALL of the accessor functions for apr_file_t types. */
   
  -apr_status_t apr_get_filename(char **fname, apr_file_t *thefile)
  +apr_status_t apr_get_filename(const char **fname, apr_file_t *thefile)
   {
   #ifdef WIN32 /* this test is only good until some other platform trys wchar* */
   #if APR_HAS_UNICODE_FS
  @@ -70,10 +70,10 @@
       }
       else
   #endif /* !APR_HAS_UNICODE_FS */
  -        *fname = apr_pstrdup(thefile->cntxt, thefile->n.fname);
  +        *fname = thefile->n.fname;
   
   #else /* !def Win32 */
  -    *fname = apr_pstrdup(thefile->cntxt, thefile->fname);
  +    *fname = thefile->fname;
   #endif 
       return APR_SUCCESS;
   }
  
  
  
  1.82      +1 -1      apr/include/apr_file_io.h
  
  Index: apr_file_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_file_io.h,v
  retrieving revision 1.81
  retrieving revision 1.82
  diff -u -r1.81 -r1.82
  --- apr_file_io.h	2000/12/17 03:35:41	1.81
  +++ apr_file_io.h	2001/01/05 00:10:10	1.82
  @@ -738,7 +738,7 @@
    * @param new_path The path of the file.  
    * @param thefile The currently open file.
    */                     
  -apr_status_t apr_get_filename(char **new_path, apr_file_t *thefile);
  +apr_status_t apr_get_filename(const char **new_path, apr_file_t *thefile);
   
   /**
    * Get the file name of the current directory entry.
  
  
  
  1.80      +70 -0     apr/lib/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/lib/apr_pools.c,v
  retrieving revision 1.79
  retrieving revision 1.80
  diff -u -r1.79 -r1.80
  --- apr_pools.c	2001/01/03 04:21:35	1.79
  +++ apr_pools.c	2001/01/05 00:10:11	1.80
  @@ -206,6 +206,14 @@
   #endif /* APR_POOL_DEBUG */
   
   #ifdef ALLOC_STATS
  +
  +typedef struct allocs {
  +    char *ploc;
  +    struct allocs *next;
  +} allocs;
  +
  +static allocs *top;
  +
   static unsigned long long num_free_blocks_calls;
   static unsigned long long num_blocks_freed;
   static unsigned max_blocks_in_one_free;
  @@ -234,6 +242,58 @@
   #define debug_verify_filled(a,b,c)
   #endif /* ALLOC_DEBUG */
   
  +#ifdef ALLOC_STATS
  +
  +static void add_alloc_stats(union block_hdr *block)
  +{
  +    allocs *newadd = malloc(sizeof(*newadd));
  +
  +    newadd->ploc = block->h.first_avail;
  +fprintf(stderr, "adding:   %p\n", newadd->ploc);
  +    if (top) {
  +        newadd->next = top;
  +    }
  +    top = newadd;
  +}
  +
  +static void remove_allocs(union block_hdr *block)
  +{
  +    allocs *remove = top;
  +    allocs *rem2 = top;
  +
  +    while (remove && (remove->ploc != block->h.first_avail)) {
  +        remove = remove->next;
  +    }
  +
  +    if (!remove) {
  +        fprintf(stderr, "Trying to remove memory that was never added, %p?\n", block->h.first_avail);
  +        fflush(stderr);
  +    }
  +    else if (remove == top) {
  +        top = top->next;
  +        free(remove);
  +    }
  +    else {
  +        while (rem2->next != remove) {
  +            rem2 = rem2->next;
  +        }
  +        rem2->next = remove->next;
  +        free(remove);
  +    }      
  +}
  +
  +static void dump_allocs(void)
  +{
  +    allocs *foo = top;
  +
  +    while (foo) {
  +        fprintf(stderr, "%p ", foo->ploc);
  +        foo = foo->next;
  +    }
  +    fprintf(stderr, "\n");
  +}
  +#endif
  +
   /*
    * Get a completely new block from the system pool. Note that we rely on
    * malloc() to provide aligned memory.
  @@ -274,6 +334,10 @@
       blok->h.owning_pool = NULL;
   #endif /* APR_POOL_DEBUG */
   
  +#ifdef ALLOC_STATS
  +    add_alloc_stats(blok);
  +#endif
  +
       return blok;
   }
   
  @@ -375,6 +439,7 @@
       }
       ++num_free_blocks_calls;
       num_blocks_freed += num_blocks;
  +    remove_allocs(blok);
   #endif /* ALLOC_STATS */
   
   #if APR_HAS_THREADS
  @@ -404,6 +469,9 @@
   	    debug_verify_filled(blok->h.first_avail, blok->h.endp,
   				"[new_block] Ouch!  Someone trounced a block "
   				"on the free list!\n");
  +#ifdef ALLOC_STATS
  +            add_alloc_stats(blok);
  +#endif
   	    return blok;
   	}
   	else {
  @@ -529,6 +597,7 @@
   	max_blocks_in_one_free,
   	num_malloc_calls,
   	num_malloc_bytes);
  +    dump_allocs();
   }
   #endif
   
  @@ -1291,3 +1360,4 @@
   	}
       }
   }
  +
  
  
  

Mime
View raw message