httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental mod_mem_cache.c
Date Fri, 06 Sep 2002 12:57:47 GMT
brianp      2002/09/06 05:57:47

  Modified:    modules/experimental mod_mem_cache.c
  Log:
  More calloc->malloc optimizations
  
  Revision  Changes    Path
  1.83      +4 -4      httpd-2.0/modules/experimental/mod_mem_cache.c
  
  Index: mod_mem_cache.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/mod_mem_cache.c,v
  retrieving revision 1.82
  retrieving revision 1.83
  diff -u -r1.82 -r1.83
  --- mod_mem_cache.c	6 Sep 2002 12:41:32 -0000	1.82
  +++ mod_mem_cache.c	6 Sep 2002 12:57:47 -0000	1.83
  @@ -660,7 +660,7 @@
           *obj=NULL;
           return APR_SUCCESS;
       }
  -    *obj = calloc(1, sizeof(cache_header_tbl_t) * elts_arr->nelts);
  +    *obj = malloc(sizeof(cache_header_tbl_t) * elts_arr->nelts);
       if (NULL == *obj) {
           return APR_ENOMEM;
       }
  @@ -671,7 +671,7 @@
       }
   
       /* Transfer the headers into a contiguous memory block */
  -    buf = calloc(1, len);
  +    buf = malloc(len);
       if (!buf) {
           *obj = NULL;
           return APR_ENOMEM;
  @@ -680,12 +680,12 @@
       for (i = 0; i < *nelts; ++i) {
           (*obj)[i].hdr = &buf[idx];
           len = strlen(elts[i].key) + 1;              /* Include NULL terminator */
  -        strncpy(&buf[idx], elts[i].key, len);
  +        memcpy(&buf[idx], elts[i].key, len);
           idx+=len;
   
           (*obj)[i].val = &buf[idx];
           len = strlen(elts[i].val) + 1;
  -        strncpy(&buf[idx], elts[i].val, len);
  +        memcpy(&buf[idx], elts[i].val, len);
           idx+=len;
       }
       return APR_SUCCESS;
  
  
  

Mime
View raw message