]> granicus.if.org Git - apache/commitdiff
More calloc->malloc optimizations
authorBrian Pane <brianp@apache.org>
Fri, 6 Sep 2002 12:57:47 +0000 (12:57 +0000)
committerBrian Pane <brianp@apache.org>
Fri, 6 Sep 2002 12:57:47 +0000 (12:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@96679 13f79535-47bb-0310-9956-ffa450edef68

modules/experimental/mod_mem_cache.c

index f7d7e44f76e258b1b1fe1d59a6ce24b7f1f38c7f..bc65af1e7875424dc83045239cc281e966f659e8 100644 (file)
@@ -660,7 +660,7 @@ static apr_status_t serialize_table(cache_header_tbl_t **obj,
         *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 @@ static apr_status_t serialize_table(cache_header_tbl_t **obj,
     }
 
     /* 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 @@ static apr_status_t serialize_table(cache_header_tbl_t **obj,
     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;