apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dr...@apache.org
Subject cvs commit: apr/memory/unix apr_memory_system.c apr_tracking_memory_system.c
Date Sun, 13 May 2001 14:43:49 GMT
dreid       01/05/13 07:43:49

  Modified:    include  apr_memory_system.h
               memory/unix apr_memory_system.c apr_tracking_memory_system.c
  Log:
  This should get the memory code building again and also added
  a patch from Sander Striker that gets apr_sms_destroy returning
  an apr_status_t correctly.
  
  Submitted by:	Sander Striker <striker@samba-tng.org>
  Reviewed by:	David Reid <dreid@apache.org>
  
  Revision  Changes    Path
  1.7       +1 -1      apr/include/apr_memory_system.h
  
  Index: apr_memory_system.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_memory_system.h,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- apr_memory_system.h	2001/05/13 12:01:28	1.6
  +++ apr_memory_system.h	2001/05/13 14:43:49	1.7
  @@ -98,7 +98,7 @@
     apr_status_t (*free_fn)(apr_sms_t *mem_sys, void *memory);
     apr_status_t (*reset_fn)(apr_sms_t *mem_sys);
     void (*pre_destroy_fn)(apr_sms_t *mem_sys);
  -  void (*destroy_fn)(apr_sms_t *mem_sys);
  +  apr_status_t (*destroy_fn)(apr_sms_t *mem_sys);
     void (*threadsafe_lock_fn)(apr_sms_t *mem_sys);
     void (*threadsafe_unlock_fn)(apr_sms_t *mem_sys);
   };
  
  
  
  1.6       +4 -7      apr/memory/unix/apr_memory_system.c
  
  Index: apr_memory_system.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_memory_system.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- apr_memory_system.c	2001/05/13 12:01:29	1.5
  +++ apr_memory_system.c	2001/05/13 14:43:49	1.6
  @@ -169,9 +169,6 @@
   
   static int apr_sms_is_tracking(apr_sms_t *mem_sys)
   {
  -#ifdef APR_ASSERT_MEMORY
  -    assert(mem_sys->reset_fn);
  -#endif
       /*
        * The presense of a reset function gives us the clue that this is a 
        * tracking memory system.
  @@ -328,7 +325,7 @@
       if (!mem_sys)
           return APR_EMEMSYS;
       if (!mem_sys->reset_fn)
  -        return APR_EMEMALLOCATOR;
  +        return APR_EINVAL; /* Not sure if this is right... */
   
       /* 
        * Run the cleanups of all child memory systems _including_
  @@ -467,15 +464,15 @@
   
     /* 1 - If we have a self destruct, use it */
     if (mem_sys->destroy_fn != NULL)
  -      mem_sys->destroy_fn(mem_sys);
  +      return mem_sys->destroy_fn(mem_sys);
   
     /* 2 - If we don't have a parent, free using ourselves */
     else if (mem_sys->parent_mem_sys == NULL)
  -      mem_sys->free_fn(mem_sys, mem_sys);
  +      return mem_sys->free_fn(mem_sys, mem_sys);
   
     /* 3 - If we do have a parent and it has a free function, use it */
     else if (mem_sys->parent_mem_sys->free_fn != NULL)
  -      apr_sms_free(mem_sys->parent_mem_sys, mem_sys);
  +      return apr_sms_free(mem_sys->parent_mem_sys, mem_sys);
   
     /* 4 - Assume we are the child of a tracking memory system, and do nothing */
   #ifdef APR_ASSERT_MEMORY
  
  
  
  1.5       +14 -4     apr/memory/unix/apr_tracking_memory_system.c
  
  Index: apr_tracking_memory_system.c
  ===================================================================
  RCS file: /home/cvs/apr/memory/unix/apr_tracking_memory_system.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- apr_tracking_memory_system.c	2001/05/13 11:11:46	1.4
  +++ apr_tracking_memory_system.c	2001/05/13 14:43:49	1.5
  @@ -208,12 +208,22 @@
       return APR_SUCCESS;
   }
   
  -static void apr_sms_tracking_destroy(apr_sms_t *mem_sys)
  +static apr_status_t apr_sms_tracking_destroy(apr_sms_t *mem_sys)
   {
  -    assert (mem_sys != NULL);
  +    apr_status_t rv;
  +    /* If this is NULL we won't blow up as it should be caught at the
  +     * next level down and then passed back to us...
  +     */
  +#ifdef APR_ASSERT_MEMORY
  +    assert (mem_sys->parent_mem_sys != NULL);
  +#endif
  +    
  +    if (!mem_sys)
  +        return APR_EMEMSYS;
   
  -    apr_sms_tracking_reset(mem_sys);
  -    apr_sms_free(mem_sys->parent_mem_sys, mem_sys);
  +    if ((rv = apr_sms_tracking_reset(mem_sys)) != APR_SUCCESS)
  +        return rv;
  +    return apr_sms_free(mem_sys->parent_mem_sys, mem_sys);
   }
   
   APR_DECLARE(apr_status_t) apr_sms_tracking_create(apr_sms_t **mem_sys, 
  
  
  

Mime
View raw message