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 Mon, 12 Aug 2002 22:02:18 GMT
striker     2002/08/12 15:02:18

  Modified:    memory/unix apr_pools.c
  Log:
  Fix pools to play nice with gcc bounds checking.
  
  Submitted by:	Blair Zajac <blair@orcaware.com>
  
  Revision  Changes    Path
  1.184     +5 -9      apr/memory/unix/apr_pools.c
  
  Index: apr_pools.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_pools.c,v
  retrieving revision 1.183
  retrieving revision 1.184
  diff -u -r1.183 -r1.184
  --- apr_pools.c	13 Jul 2002 21:38:02 -0000	1.183
  +++ apr_pools.c	12 Aug 2002 22:02:18 -0000	1.184
  @@ -606,24 +606,21 @@
   {
       apr_memnode_t *active, *node;
       void *mem;
  -    char *endp;
       apr_uint32_t free_index;
   
       size = APR_ALIGN_DEFAULT(size);
       active = pool->active;
   
       /* If the active node has enough bytes left, use it. */
  -    endp = active->first_avail + size;
  -    if (endp < active->endp) {
  +    if (size < active->endp - active->first_avail) {
           mem = active->first_avail;
  -        active->first_avail = endp;
  +        active->first_avail += size;
   
           return mem;
       }
   
       node = active->next;
  -    endp = node->first_avail + size;
  -    if (endp < node->endp) {
  +    if (size < node->endp - node->first_avail) {
           *node->ref = node->next;
           node->next->ref = node->ref;
       }
  @@ -634,13 +631,12 @@
   
               return NULL;
           }
  -        endp = node->first_avail + size;
       }
   
       node->free_index = 0;
   
       mem = node->first_avail;
  -    node->first_avail = endp;
  +    node->first_avail += size;
   
       node->ref = active->ref;
       *node->ref = node;
  @@ -929,7 +925,7 @@
           size = APR_PSPRINTF_MIN_STRINGSIZE;
   
       node = active->next;
  -    if (!ps->got_a_new_node && node->first_avail + size < node->endp)
{
  +    if (!ps->got_a_new_node && size < node->endp - node->first_avail)
{
           *node->ref = node->next;
           node->next->ref = node->ref;
   
  
  
  

Mime
View raw message