trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject svn commit: r1165149 - in /trafficserver/traffic/trunk: lib/ts/ink_memory.cc lib/ts/ink_memory.h mgmt/api/CoreAPIShared.cc proxy/TestHook.cc proxy/logging/LogAccess.cc
Date Mon, 05 Sep 2011 02:22:26 GMT
Author: zwoop
Date: Mon Sep  5 02:22:25 2011
New Revision: 1165149

URL: http://svn.apache.org/viewvc?rev=1165149&view=rev
Log:
TS-567 Remove ats_memcpy(), it is actually slower than plain memcpy

Modified:
    trafficserver/traffic/trunk/lib/ts/ink_memory.cc
    trafficserver/traffic/trunk/lib/ts/ink_memory.h
    trafficserver/traffic/trunk/mgmt/api/CoreAPIShared.cc
    trafficserver/traffic/trunk/proxy/TestHook.cc
    trafficserver/traffic/trunk/proxy/logging/LogAccess.cc

Modified: trafficserver/traffic/trunk/lib/ts/ink_memory.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_memory.cc?rev=1165149&r1=1165148&r2=1165149&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_memory.cc (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_memory.cc Mon Sep  5 02:22:25 2011
@@ -1,6 +1,6 @@
 /** @file
 
-  A brief file description
+  Memory allocation routines for libts
 
   @section license License
 
@@ -20,15 +20,6 @@
   See the License for the specific language governing permissions and
   limitations under the License.
  */
-
-/****************************************************************************
-
-  ink_memory.c
-
-  Memory allocation routines for libts
-
- ****************************************************************************/
-
 #include "libts.h"
 
 #include <assert.h>
@@ -176,92 +167,3 @@ ats_free(void *ptr)
   else
     ink_warning("ats_free: freeing a NULL pointer");
 }                               /* End ats_free */
-
-
-void *
-ats_memcpy(void *s1, const void *s2, int n)
-{
-  register int i;
-  register char *s, *d;
-
-  s = (char *) s2;
-  d = (char *) s1;
-
-  if (n <= 8) {
-    switch (n) {
-    case 0:
-      break;
-    case 1:
-      d[0] = s[0];
-      break;
-    case 2:
-      d[0] = s[0];
-      d[1] = s[1];
-      break;
-    case 3:
-      d[0] = s[0];
-      d[1] = s[1];
-      d[2] = s[2];
-      break;
-    case 4:
-      d[0] = s[0];
-      d[1] = s[1];
-      d[2] = s[2];
-      d[3] = s[3];
-      break;
-    case 5:
-      d[0] = s[0];
-      d[1] = s[1];
-      d[2] = s[2];
-      d[3] = s[3];
-      d[4] = s[4];
-      break;
-    case 6:
-      d[0] = s[0];
-      d[1] = s[1];
-      d[2] = s[2];
-      d[3] = s[3];
-      d[4] = s[4];
-      d[5] = s[5];
-      break;
-    case 7:
-      d[0] = s[0];
-      d[1] = s[1];
-      d[2] = s[2];
-      d[3] = s[3];
-      d[4] = s[4];
-      d[5] = s[5];
-      d[6] = s[6];
-      break;
-    case 8:
-      d[0] = s[0];
-      d[1] = s[1];
-      d[2] = s[2];
-      d[3] = s[3];
-      d[4] = s[4];
-      d[5] = s[5];
-      d[6] = s[6];
-      d[7] = s[7];
-      break;
-    default:
-      ink_assert(0);
-    }
-  } else if (n < 128) {
-    for (i = 0; i + 7 < n; i += 8) {
-      d[i + 0] = s[i + 0];
-      d[i + 1] = s[i + 1];
-      d[i + 2] = s[i + 2];
-      d[i + 3] = s[i + 3];
-      d[i + 4] = s[i + 4];
-      d[i + 5] = s[i + 5];
-      d[i + 6] = s[i + 6];
-      d[i + 7] = s[i + 7];
-    }
-    for (; i < n; i++)
-      d[i] = s[i];
-  } else {
-    memcpy(s1, s2, n);
-  }
-
-  return s1;
-}                               /* End ats_memcpy */

Modified: trafficserver/traffic/trunk/lib/ts/ink_memory.h
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/lib/ts/ink_memory.h?rev=1165149&r1=1165148&r2=1165149&view=diff
==============================================================================
--- trafficserver/traffic/trunk/lib/ts/ink_memory.h (original)
+++ trafficserver/traffic/trunk/lib/ts/ink_memory.h Mon Sep  5 02:22:25 2011
@@ -36,7 +36,6 @@ extern "C"
   void *ats_memalign(size_t alignment, size_t size);
   void ats_free(void *ptr);
   void ats_memalign_free(void *ptr);
-  void *ats_memcpy(void *s1, const void *s2, int n);
 
 #ifdef __cplusplus
 }

Modified: trafficserver/traffic/trunk/mgmt/api/CoreAPIShared.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/mgmt/api/CoreAPIShared.cc?rev=1165149&r1=1165148&r2=1165149&view=diff
==============================================================================
--- trafficserver/traffic/trunk/mgmt/api/CoreAPIShared.cc (original)
+++ trafficserver/traffic/trunk/mgmt/api/CoreAPIShared.cc Mon Sep  5 02:22:25 2011
@@ -262,7 +262,7 @@ connectDirect(const char *host, int port
   if (!pHostent) {
     goto error;
   }
-  ats_memcpy((caddr_t)&(name.sin_addr), pHostent->h_addr, pHostent->h_length);
+  memcpy((caddr_t)&(name.sin_addr), pHostent->h_addr, pHostent->h_length);
 
   do {
     err = connect(sock, (struct sockaddr *) &name, sizeof(name));

Modified: trafficserver/traffic/trunk/proxy/TestHook.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/TestHook.cc?rev=1165149&r1=1165148&r2=1165149&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/TestHook.cc (original)
+++ trafficserver/traffic/trunk/proxy/TestHook.cc Mon Sep  5 02:22:25 2011
@@ -348,7 +348,7 @@ StateMachine::fill()
   // write header
   if (hdr_bytes_left) {
     copy_size = min(n, hdr_bytes_left);
-    ats_memcpy(ptr, scratch_space + header_size_written, copy_size);
+    memcpy(ptr, scratch_space + header_size_written, copy_size);
     ptr += copy_size;
     header_size_written += copy_size;
     hdr_bytes_left -= copy_size;

Modified: trafficserver/traffic/trunk/proxy/logging/LogAccess.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/logging/LogAccess.cc?rev=1165149&r1=1165148&r2=1165149&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/logging/LogAccess.cc (original)
+++ trafficserver/traffic/trunk/proxy/logging/LogAccess.cc Mon Sep  5 02:22:25 2011
@@ -697,7 +697,7 @@ LogAccess::marshal_record(char *record, 
           num_chars =::strlen(out_buf) + 1;
           if (num_chars > max_chars) {
             // truncate string and write ellipsis at the end
-            ats_memcpy(ascii_buf, out_buf, max_chars - 4);
+            memcpy(ascii_buf, out_buf, max_chars - 4);
             ascii_buf[max_chars - 1] = 0;
             ascii_buf[max_chars - 2] = '.';
             ascii_buf[max_chars - 3] = '.';
@@ -723,7 +723,7 @@ LogAccess::marshal_record(char *record, 
   }
 
   ink_debug_assert(num_chars <= max_chars);
-  ats_memcpy(buf, out_buf, num_chars);
+  memcpy(buf, out_buf, num_chars);
 
 #ifdef PURIFY
   for (unsigned int i = num_chars + 1; i < max_chars; ++i) {



Mime
View raw message