You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2012/03/24 02:09:37 UTC

git commit: TS-1150 Consistently use HDR_BUF_RONLY_HEAPS

Updated Branches:
  refs/heads/master 60e961884 -> 601490423


TS-1150 Consistently use HDR_BUF_RONLY_HEAPS


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/60149042
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/60149042
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/60149042

Branch: refs/heads/master
Commit: 60149042383cb9bd12dbe1c06d05c19fb2358c19
Parents: 60e9618
Author: Leif Hedstrom <le...@ogre.com>
Authored: Fri Mar 23 19:09:28 2012 -0600
Committer: Leif Hedstrom <le...@ogre.com>
Committed: Fri Mar 23 19:09:28 2012 -0600

----------------------------------------------------------------------
 proxy/CoreUtils.cc    |    4 ++--
 proxy/hdrs/HdrHeap.cc |   24 +++++++++---------------
 2 files changed, 11 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60149042/proxy/CoreUtils.cc
----------------------------------------------------------------------
diff --git a/proxy/CoreUtils.cc b/proxy/CoreUtils.cc
index 25ca992..9c79af4 100644
--- a/proxy/CoreUtils.cc
+++ b/proxy/CoreUtils.cc
@@ -785,8 +785,8 @@ CoreUtils::load_http_hdr(HTTPHdr * core_hdr, HTTPHdr * live_hdr)
   swizzle_heap->m_ronly_heap[0].m_heap_start = (char *)(intptr_t)swizzle_heap->m_size;   // offset
   swizzle_heap->m_ronly_heap[0].m_ref_count_ptr.m_ptr = NULL;
 
-  swizzle_heap->m_ronly_heap[1].m_heap_start = NULL;
-  swizzle_heap->m_ronly_heap[2].m_heap_start = NULL;
+  for (int i = 1; i < HDR_BUF_RONLY_HEAPS; i++)
+    swizzle_heap->m_ronly_heap[i].m_heap_start = NULL;
 
   // Next order of business is to copy over string heaps
   //   As we are copying over the string heaps, build

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/60149042/proxy/hdrs/HdrHeap.cc
----------------------------------------------------------------------
diff --git a/proxy/hdrs/HdrHeap.cc b/proxy/hdrs/HdrHeap.cc
index 9bf2be4..997fa1f 100644
--- a/proxy/hdrs/HdrHeap.cc
+++ b/proxy/hdrs/HdrHeap.cc
@@ -103,16 +103,11 @@ HdrHeap::init()
   //  garbage it is pointing to
   m_read_write_heap.m_ptr = NULL;
 
-  m_ronly_heap[0].m_heap_start = NULL;
-  m_ronly_heap[0].m_ref_count_ptr.m_ptr = NULL;
-  m_ronly_heap[0].m_locked = false;
-  m_ronly_heap[1].m_heap_start = NULL;
-  m_ronly_heap[1].m_ref_count_ptr.m_ptr = NULL;
-  m_ronly_heap[1].m_locked = false;
-  m_ronly_heap[2].m_heap_start = NULL;
-  m_ronly_heap[2].m_ref_count_ptr.m_ptr = NULL;
-  m_ronly_heap[2].m_locked = false;
-
+  for (int i = 0; i < HDR_BUF_RONLY_HEAPS; i++) {
+    m_ronly_heap[i].m_heap_start = NULL;
+    m_ronly_heap[i].m_ref_count_ptr.m_ptr = NULL;
+    m_ronly_heap[i].m_locked = false;
+  }
   m_lost_string_space = 0;
 
   ink_assert(m_free_size > 0);
@@ -184,9 +179,8 @@ HdrHeap::destroy()
   }
 
   m_read_write_heap = NULL;
-  m_ronly_heap[0].m_ref_count_ptr = NULL;
-  m_ronly_heap[1].m_ref_count_ptr = NULL;
-  m_ronly_heap[2].m_ref_count_ptr = NULL;
+  for (int i = 0; i < HDR_BUF_RONLY_HEAPS; i++)
+    m_ronly_heap[i].m_ref_count_ptr = NULL;
 
   if (m_size == HDR_HEAP_DEFAULT_SIZE) {
     hdrHeapAllocator.free_void(this);
@@ -676,8 +670,8 @@ HdrHeap::marshal(char *buf, int len)
   marshal_hdr->m_ronly_heap[0].m_heap_start = (char *)(intptr_t)marshal_hdr->m_size;     // offset
   marshal_hdr->m_ronly_heap[0].m_ref_count_ptr.m_ptr = NULL;
 
-  marshal_hdr->m_ronly_heap[1].m_heap_start = NULL;
-  marshal_hdr->m_ronly_heap[2].m_heap_start = NULL;
+  for (int i = 1; i < HDR_BUF_RONLY_HEAPS; i++)
+    marshal_hdr->m_ronly_heap[i].m_heap_start = NULL;
 
   // Next order of business is to copy over string heaps
   //   As we are copying over the string heaps, build