subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1722879 - in /subversion/trunk/subversion/libsvn_subr: eol.c utf_validate.c
Date Mon, 04 Jan 2016 14:17:05 GMT
Author: stefan2
Date: Mon Jan  4 14:17:04 2016
New Revision: 1722879

URL: http://svn.apache.org/viewvc?rev=1722879&view=rev
Log:
Stop using pointer arithmetics to check for proper alignment because
that is not portable.

As a result, platforms that don't allow unaligned data access will
suffer a small additional performance hit.

* subversion/libsvn_subr/eol.c
  (svn_eol__find_eol_start): No longer attempt aligned chunky processing
                             when unaligned access is not supported.

* subversion/libsvn_subr/utf_validate.c
  (first_non_fsm_start_char): Same.

Modified:
    subversion/trunk/subversion/libsvn_subr/eol.c
    subversion/trunk/subversion/libsvn_subr/utf_validate.c

Modified: subversion/trunk/subversion/libsvn_subr/eol.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/eol.c?rev=1722879&r1=1722878&r2=1722879&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/eol.c (original)
+++ subversion/trunk/subversion/libsvn_subr/eol.c Mon Jan  4 14:17:04 2016
@@ -33,20 +33,7 @@
 char *
 svn_eol__find_eol_start(char *buf, apr_size_t len)
 {
-#if !SVN_UNALIGNED_ACCESS_IS_OK
-
-  /* On some systems, we need to make sure that BUF is properly aligned
-   * for chunky data access. This overhead is still justified because
-   * lines tend to be tens of chars long.
-   */
-  for (; (len > 0) && ((apr_uintptr_t)buf) & (sizeof(apr_uintptr_t)-1)
-       ; ++buf, --len)
-  {
-    if (*buf == '\n' || *buf == '\r')
-      return buf;
-  }
-
-#endif
+#if SVN_UNALIGNED_ACCESS_IS_OK
 
   /* Scan the input one machine word at a time. */
   for (; len > sizeof(apr_uintptr_t)
@@ -71,6 +58,8 @@ svn_eol__find_eol_start(char *buf, apr_s
       break;
   }
 
+#endif
+
   /* The remaining odd bytes will be examined the naive way: */
   for (; len > 0; ++buf, --len)
     {

Modified: subversion/trunk/subversion/libsvn_subr/utf_validate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf_validate.c?rev=1722879&r1=1722878&r2=1722879&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf_validate.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf_validate.c Mon Jan  4 14:17:04 2016
@@ -258,24 +258,7 @@ static const char machine [9][14] = {
 static const char *
 first_non_fsm_start_char(const char *data, apr_size_t max_len)
 {
-#if !SVN_UNALIGNED_ACCESS_IS_OK
-
-  /* On some systems, we need to make sure that buf is properly aligned
-   * for chunky data access.
-   */
-  if ((apr_uintptr_t)data & (sizeof(apr_uintptr_t)-1))
-    {
-      apr_size_t len = (~(apr_uintptr_t)data) & (sizeof(apr_uintptr_t)-1);
-      if (len > max_len)
-        len = max_len;
-      max_len -= len;
-
-      for (; len > 0; ++data, --len)
-        if ((unsigned char)*data >= 0x80)
-          return data;
-    }
-
-#endif
+#if SVN_UNALIGNED_ACCESS_IS_OK
 
   /* Scan the input one machine word at a time. */
   for (; max_len > sizeof(apr_uintptr_t)
@@ -283,6 +266,8 @@ first_non_fsm_start_char(const char *dat
     if (*(const apr_uintptr_t *)data & SVN__BIT_7_SET)
       break;
 
+#endif
+
   /* The remaining odd bytes will be examined the naive way: */
   for (; max_len > 0; ++data, --max_len)
     if ((unsigned char)*data >= 0x80)



Mime
View raw message