apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr-util/misc apr_rmm.c
Date Fri, 04 Oct 2002 18:06:16 GMT
trawick     2002/10/04 11:06:16

  Modified:    misc     apr_rmm.c
  Log:
  axe some broken error checking
  
  PR: 12616
  
  Revision  Changes    Path
  1.17      +6 -12     apr-util/misc/apr_rmm.c
  
  Index: apr_rmm.c
  ===================================================================
  RCS file: /home/cvs/apr-util/misc/apr_rmm.c,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- apr_rmm.c	16 Jul 2002 13:09:02 -0000	1.16
  +++ apr_rmm.c	4 Oct 2002 18:06:16 -0000	1.17
  @@ -325,13 +325,11 @@
   
   APU_DECLARE(apr_rmm_off_t) apr_rmm_malloc(apr_rmm_t *rmm, apr_size_t reqsize)
   {
  -    apr_status_t rv;
       apr_rmm_off_t this;
       
       reqsize = (1 + (reqsize - 1) / grain) * grain;
   
  -    if ((rv = APR_ANYLOCK_LOCK(&rmm->lock)) != APR_SUCCESS)
  -        return rv;
  +    APR_ANYLOCK_LOCK(&rmm->lock);
   
       this = find_block_of_size(rmm, reqsize + sizeof(rmm_block_t));
   
  @@ -346,13 +344,11 @@
   
   APU_DECLARE(apr_rmm_off_t) apr_rmm_calloc(apr_rmm_t *rmm, apr_size_t reqsize)
   {
  -    apr_status_t rv;
       apr_rmm_off_t this;
           
       reqsize = (1 + (reqsize - 1) / grain) * grain;
   
  -    if ((rv = APR_ANYLOCK_LOCK(&rmm->lock)) != APR_SUCCESS)
  -        return rv;
  +    APR_ANYLOCK_LOCK(&rmm->lock);
   
       this = find_block_of_size(rmm, reqsize + sizeof(rmm_block_t));
   
  @@ -379,15 +375,13 @@
       reqsize = (1 + (reqsize - 1) / grain) * grain;
       old = apr_rmm_offset_get(rmm, entity);
   
  -    if ((this = apr_rmm_malloc(rmm, reqsize)) < 0) {
  +    if ((this = apr_rmm_malloc(rmm, reqsize)) == 0) {
           return this;
       }
   
  -    if (old >= 0) {
  -        memcpy(apr_rmm_addr_get(rmm, this),
  -               apr_rmm_addr_get(rmm, old), reqsize);
  -        apr_rmm_free(rmm, old);
  -    }
  +    memcpy(apr_rmm_addr_get(rmm, this),
  +           apr_rmm_addr_get(rmm, old), reqsize);
  +    apr_rmm_free(rmm, old);
   
       return this;
   }
  
  
  

Mime
View raw message