You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2010/08/13 00:13:56 UTC

svn commit: r985014 - in /subversion/branches/performance/subversion: libsvn_client/ libsvn_ra_svn/ libsvn_repos/ libsvn_subr/ svn/

Author: stefan2
Date: Thu Aug 12 22:13:56 2010
New Revision: 985014

URL: http://svn.apache.org/viewvc?rev=985014&view=rev
Log:
Use svn_ctype_is* functions instead of the corresponding apr_is* wrappers
around the locale-dependent CRT implementations. Not all places are actually
performance critical but we should prefer consequent use of svn_* functions 
over a mixture of functions with different implementations.

* subversion/svn/util.c
  (svn_cl__get_log_message): use svn_ctype_is* instead of apr_is*
* subversion/libsvn_subr/utf.c
  (check_non_ascii): dito
* subversion/libsvn_subr/svn_string.c
  (string_first_non_whitespace, svn_stringbuf_strip_whitespace,
   svn_cstring_split_append): dito
* subversion/libsvn_subr/path.c
  (svn_path_is_uri_safe, svn_path_uri_decode): dito
* subversion/libsvn_subr/opt.c
  (parse_one_rev): dito
* subversion/libsvn_subr/io.c
  (svn_io_read_version_file): dito
* subversion/libsvn_subr/dirent_uri.c
  (canonicalize, svn_uri_is_canonical): dito
* subversion/libsvn_subr/config_file.c
  (skip_whitespace): dito
* subversion/libsvn_repos/load.c
  (svn_repos_parse_dumpstream2): dito
* subversion/libsvn_ra_svn/marshal.c
  (read_item): dito
* subversion/libsvn_client/add.c
  (trim_string): dito

Modified:
    subversion/branches/performance/subversion/libsvn_client/add.c
    subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c
    subversion/branches/performance/subversion/libsvn_repos/load.c
    subversion/branches/performance/subversion/libsvn_subr/config_file.c
    subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c
    subversion/branches/performance/subversion/libsvn_subr/io.c
    subversion/branches/performance/subversion/libsvn_subr/opt.c
    subversion/branches/performance/subversion/libsvn_subr/path.c
    subversion/branches/performance/subversion/libsvn_subr/svn_string.c
    subversion/branches/performance/subversion/libsvn_subr/utf.c
    subversion/branches/performance/subversion/svn/util.c

Modified: subversion/branches/performance/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_client/add.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_client/add.c (original)
+++ subversion/branches/performance/subversion/libsvn_client/add.c Thu Aug 12 22:13:56 2010
@@ -43,6 +43,7 @@
 #include "svn_hash.h"
 #include "svn_sorts.h"
 #include "client.h"
+#include "svn_ctype.h"
 
 #include "private/svn_wc_private.h"
 
@@ -80,11 +81,11 @@ trim_string(char **pstr)
   char *str = *pstr;
   size_t i;
 
-  while (apr_isspace(*str))
+  while (svn_ctype_isspace(*str))
     str++;
   *pstr = str;
   i = strlen(str);
-  while ((i > 0) && apr_isspace(str[i-1]))
+  while ((i > 0) && svn_ctype_isspace(str[i-1]))
     i--;
   str[i] = '\0';
 }

Modified: subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c (original)
+++ subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c Thu Aug 12 22:13:56 2010
@@ -38,6 +38,7 @@
 #include "svn_pools.h"
 #include "svn_ra_svn.h"
 #include "svn_private_config.h"
+#include "svn_ctype.h"
 
 #include "ra_svn.h"
 
@@ -619,7 +620,7 @@ static svn_error_t *read_item(svn_ra_svn
         {
           prev_val = val;
           SVN_ERR(readbuf_getchar(conn, pool, &c));
-          if (!apr_isdigit(c))
+          if (!svn_ctype_isdigit(c))
             break;
           val = val * 10 + (c - '0');
           if ((val / 10) != prev_val) /* val wrapped past maximum value */
@@ -646,7 +647,7 @@ static svn_error_t *read_item(svn_ra_svn
       while (1)
         {
           SVN_ERR(readbuf_getchar(conn, pool, &c));
-          if (!apr_isalnum(c) && c != '-')
+          if (!svn_ctype_isalnum(c) && c != '-')
             break;
           svn_stringbuf_appendbytes(str, &c, 1);
         }

Modified: subversion/branches/performance/subversion/libsvn_repos/load.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_repos/load.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_repos/load.c (original)
+++ subversion/branches/performance/subversion/libsvn_repos/load.c Thu Aug 12 22:13:56 2010
@@ -34,6 +34,7 @@
 #include "svn_mergeinfo.h"
 #include "svn_checksum.h"
 #include "svn_subst.h"
+#include "svn_ctype.h"
 
 #include <apr_lib.h>
 
@@ -705,7 +706,7 @@ svn_repos_parse_dumpstream2(svn_stream_t
             return stream_ran_dry();
         }
 
-      if ((linebuf->len == 0) || (apr_isspace(linebuf->data[0])))
+      if ((linebuf->len == 0) || (svn_ctype_isspace(linebuf->data[0])))
         continue; /* empty line ... loop */
 
       /*** Found the beginning of a new record. ***/

Modified: subversion/branches/performance/subversion/libsvn_subr/config_file.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/config_file.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/config_file.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/config_file.c Thu Aug 12 22:13:56 2010
@@ -34,6 +34,7 @@
 #include "svn_utf.h"
 #include "svn_pools.h"
 #include "svn_user.h"
+#include "svn_ctype.h"
 
 #include "svn_private_config.h"
 
@@ -121,7 +122,7 @@ skip_whitespace(parse_context_t *ctx, in
   int count = 0;
 
   SVN_ERR(parser_getc(ctx, &ch));
-  while (ch != EOF && ch != '\n' && apr_isspace(ch))
+  while (ch != EOF && ch != '\n' && svn_ctype_isspace(ch))
     {
       ++count;
       SVN_ERR(parser_getc(ctx, &ch));

Modified: subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/dirent_uri.c Thu Aug 12 22:13:56 2010
@@ -34,6 +34,7 @@
 #include "svn_string.h"
 #include "svn_dirent_uri.h"
 #include "svn_path.h"
+#include "svn_ctype.h"
 
 #include "dirent_uri.h"
 
@@ -549,7 +550,8 @@ canonicalize(path_type_t type, const cha
               case '/':
                 break;
               case '%':
-                if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+                if (!svn_ctype_isxdigit(*(src+1)) ||
+                    !svn_ctype_isxdigit(*(src+2)))
                   need_extra += 2;
                 else
                   src += 2;
@@ -585,7 +587,8 @@ canonicalize(path_type_t type, const cha
                 *(dst++) = '/';
                 break;
               case '%':
-                if (!apr_isxdigit(*(src+1)) || !apr_isxdigit(*(src+2)))
+                if (!svn_ctype_isxdigit(*(src+1)) ||
+                    !svn_ctype_isxdigit(*(src+2)))
                   {
                     *(dst++) = '%';
                     *(dst++) = '2';
@@ -1899,7 +1902,7 @@ svn_uri_is_canonical(const char *uri, ap
               char digitz[3];
               int val;
 
-              /* Can't use apr_isxdigit() because lower case letters are
+              /* Can't usesvn_ctype_isxdigit() because lower case letters are
                  not in our canonical format */
               if (((*(ptr+1) < '0' || *(ptr+1) > '9')) 
                   && (*(ptr+1) < 'A' || *(ptr+1) > 'F'))

Modified: subversion/branches/performance/subversion/libsvn_subr/io.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/io.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/io.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/io.c Thu Aug 12 22:13:56 2010
@@ -57,6 +57,7 @@
 #include "svn_utf.h"
 #include "svn_config.h"
 #include "svn_private_config.h"
+#include "svn_ctype.h"
 
 #include "private/svn_atomic.h"
 
@@ -3508,7 +3509,7 @@ svn_io_read_version_file(int *version,
 
         if (i > 0 && (c == '\r' || c == '\n'))
           break;
-        if (! apr_isdigit(c))
+        if (! svn_ctype_isdigit(c))
           return svn_error_createf
             (SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL,
              _("First line of '%s' contains non-digit"),

Modified: subversion/branches/performance/subversion/libsvn_subr/opt.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/opt.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/opt.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/opt.c Thu Aug 12 22:13:56 2010
@@ -43,6 +43,7 @@
 #include "svn_utf.h"
 #include "svn_time.h"
 #include "svn_props.h"
+#include "svn_ctype.h"
 
 #include "private/svn_opt_private.h"
 
@@ -456,11 +457,11 @@ static char *parse_one_rev(svn_opt_revis
       revision->value.date = tm;
       return end + 1;
     }
-  else if (apr_isdigit(*str))
+  else if (svn_ctype_isdigit(*str))
     {
       /* It's a number. */
       end = str + 1;
-      while (apr_isdigit(*end))
+      while (svn_ctype_isdigit(*end))
         end++;
       save = *end;
       *end = '\0';
@@ -469,10 +470,10 @@ static char *parse_one_rev(svn_opt_revis
       *end = save;
       return end;
     }
-  else if (apr_isalpha(*str))
+  else if (svn_ctype_isalpha(*str))
     {
       end = str + 1;
-      while (apr_isalpha(*end))
+      while (svn_ctype_isalpha(*end))
         end++;
       save = *end;
       *end = '\0';

Modified: subversion/branches/performance/subversion/libsvn_subr/path.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/path.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/path.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/path.c Thu Aug 12 22:13:56 2010
@@ -727,7 +727,8 @@ svn_path_is_uri_safe(const char *path)
       /* Allow '%XX' (where each X is a hex digit) */
       if (path[i] == '%')
         {
-          if (apr_isxdigit(path[i + 1]) && apr_isxdigit(path[i + 2]))
+          if (svn_ctype_isxdigit(path[i + 1]) &&
+              svn_ctype_isxdigit(path[i + 2]))
             {
               i += 2;
               continue;
@@ -897,8 +898,8 @@ svn_path_uri_decode(const char *path, ap
            * RFC 2396, section 3.3  */
           c = ' ';
         }
-      else if (c == '%' && apr_isxdigit(path[i + 1])
-               && apr_isxdigit(path[i+2]))
+      else if (c == '%' && svn_ctype_isxdigit(path[i + 1])
+               && svn_ctype_isxdigit(path[i+2]))
         {
           char digitz[3];
           digitz[0] = path[++i];

Modified: subversion/branches/performance/subversion/libsvn_subr/svn_string.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/svn_string.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/svn_string.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/svn_string.c Thu Aug 12 22:13:56 2010
@@ -84,7 +84,7 @@ string_first_non_whitespace(const char *
 
   for (i = 0; i < len; i++)
     {
-      if (! apr_isspace(str[i]))
+      if (! svn_ctype_isspace(str[i]))
         return i;
     }
 
@@ -460,7 +460,7 @@ svn_stringbuf_strip_whitespace(svn_strin
   str->blocksize -= offset;
 
   /* Now that we've trimmed the front, trim the end, wasting more RAM. */
-  while ((str->len > 0) && apr_isspace(str->data[str->len - 1]))
+  while ((str->len > 0) && svn_ctype_isspace(str->data[str->len - 1]))
     str->len--;
   str->data[str->len] = '\0';
 }
@@ -502,12 +502,12 @@ svn_cstring_split_append(apr_array_heade
     {
       if (chop_whitespace)
         {
-          while (apr_isspace(*p))
+          while (svn_ctype_isspace(*p))
             p++;
 
           {
             char *e = p + (strlen(p) - 1);
-            while ((e >= p) && (apr_isspace(*e)))
+            while ((e >= p) && (svn_ctype_isspace(*e)))
               e--;
             *(++e) = '\0';
           }

Modified: subversion/branches/performance/subversion/libsvn_subr/utf.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/utf.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/libsvn_subr/utf.c (original)
+++ subversion/branches/performance/subversion/libsvn_subr/utf.c Thu Aug 12 22:13:56 2010
@@ -530,9 +530,9 @@ check_non_ascii(const char *data, apr_si
 
   for (; len > 0; --len, data++)
     {
-      if ((! apr_isascii(*data))
-          || ((! apr_isspace(*data))
-              && apr_iscntrl(*data)))
+      if ((! svn_ctype_isascii(*data))
+          || ((! svn_ctype_isspace(*data))
+              && svn_ctype_iscntrl(*data)))
         {
           /* Show the printable part of the data, followed by the
              decimal code of the questionable character.  Because if a

Modified: subversion/branches/performance/subversion/svn/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svn/util.c?rev=985014&r1=985013&r2=985014&view=diff
==============================================================================
--- subversion/branches/performance/subversion/svn/util.c (original)
+++ subversion/branches/performance/subversion/svn/util.c Thu Aug 12 22:13:56 2010
@@ -828,8 +828,8 @@ svn_cl__get_log_message(const char **log
           for (len = message->len - 1; len >= 0; len--)
             {
               /* FIXME: should really use an UTF-8 whitespace test
-                 rather than apr_isspace, which is locale dependant */
-              if (! apr_isspace(message->data[len]))
+                 rather than svn_ctype_isspace, which is ASCII only */
+              if (! svn_ctype_isspace(message->data[len]))
                 break;
             }
           if (len < 0)