Author: stefan2 Date: Sun Aug 15 13:09:33 2010 New Revision: 985669 URL: http://svn.apache.org/viewvc?rev=985669&view=rev Log: Follow-up to r985014: replace apr_is_* in even more places, in particular in tests
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/libsvn_fs_fs/fs_fs.c (check_format_file_buffer_numeric): use svn_ctype_is* instead of apr_is* * subversion/libsvn_ra_svn/marshal.c (read_item): dito * subversion/libsvn_subr/validate.c (svn_mime_type_validate): dito * subversion/mod_dav_svn/repos.c (get_entry): dito * subversion/svnserve/log-escape.c (escape_errorlog_item): dito * subversion/tests/libsvn_delta/delta-window-test.h (delta_window_print): dito * subversion/tests/svn_test_main.c (do_test_num): dito Modified: subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c subversion/branches/performance/subversion/libsvn_subr/validate.c subversion/branches/performance/subversion/mod_dav_svn/repos.c subversion/branches/performance/subversion/svnserve/log-escape.c subversion/branches/performance/subversion/tests/libsvn_delta/delta-window-test.h subversion/branches/performance/subversion/tests/svn_test_main.c Modified: subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c?rev=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c (original) +++ subversion/branches/performance/subversion/libsvn_fs_fs/fs_fs.c Sun Aug 15 13:09:33 2010 @@ -927,7 +927,7 @@ check_format_file_buffer_numeric(const c const char *p; for (p = buf; *p; p++) - if (!apr_isdigit(*p)) + if (!svn_ctype_isdigit(*p)) return svn_error_createf(SVN_ERR_BAD_VERSION_FILE_FORMAT, NULL, _("Format file '%s' contains an unexpected non-digit"), svn_dirent_local_style(path, pool)); 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=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c (original) +++ subversion/branches/performance/subversion/libsvn_ra_svn/marshal.c Sun Aug 15 13:09:33 2010 @@ -656,7 +656,7 @@ static svn_error_t *read_item(svn_ra_svn /* Determine the item type and read it in. Make sure that c is the * first character at the end of the item so we can test to make * sure it's whitespace. */ - if (apr_isdigit(c)) + if (svn_ctype_isdigit(c)) { /* It's a number or a string. Read the number part, either way. */ val = c - '0'; @@ -684,7 +684,7 @@ static svn_error_t *read_item(svn_ra_svn item->u.number = val; } } - else if (apr_isalpha(c)) + else if (svn_ctype_isalpha(c)) { /* It's a word. */ str = svn_stringbuf_create_ensure(16, pool); Modified: subversion/branches/performance/subversion/libsvn_subr/validate.c URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/libsvn_subr/validate.c?rev=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/libsvn_subr/validate.c (original) +++ subversion/branches/performance/subversion/libsvn_subr/validate.c Sun Aug 15 13:09:33 2010 @@ -27,11 +27,11 @@ /*** Includes. ***/ -#include <apr_lib.h> #define APR_WANT_STRFUNC #include <apr_want.h> #include "svn_error.h" +#include "svn_ctype.h" #include "svn_private_config.h" @@ -63,9 +63,9 @@ svn_mime_type_validate(const char *mime_ for (i = 0; i < len; i++) { if (&mime_type[i] != slash_pos - && (! apr_isascii(mime_type[i]) - || apr_iscntrl(mime_type[i]) - || apr_isspace(mime_type[i]) + && (! svn_ctype_isascii(mime_type[i]) + || svn_ctype_iscntrl(mime_type[i]) + || svn_ctype_isspace(mime_type[i]) || (strchr(tspecials, mime_type[i]) != NULL))) return svn_error_createf (SVN_ERR_BAD_MIME_TYPE, NULL, Modified: subversion/branches/performance/subversion/mod_dav_svn/repos.c URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/mod_dav_svn/repos.c?rev=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/mod_dav_svn/repos.c (original) +++ subversion/branches/performance/subversion/mod_dav_svn/repos.c Sun Aug 15 13:09:33 2010 @@ -1519,7 +1519,7 @@ static const char *get_entry(apr_pool_t /* Look for 'var = value' --- and make sure the var is in lcase. */ - for (cp = parm; (*cp && !apr_isspace(*cp) && *cp != '='); ++cp) + for (cp = parm; (*cp && !svn_ctype_isspace(*cp) && *cp != '='); ++cp) { *cp = apr_tolower(*cp); } @@ -1530,7 +1530,7 @@ static const char *get_entry(apr_pool_t } *cp++ = '\0'; /* Delimit var */ - while (*cp && (apr_isspace(*cp) || *cp == '=')) + while (*cp && (svn_ctype_isspace(*cp) || *cp == '=')) { ++cp; } @@ -1544,7 +1544,7 @@ static const char *get_entry(apr_pool_t } else { - for (end = cp; (*end && !apr_isspace(*end)); end++); + for (end = cp; (*end && !svn_ctype_isspace(*end)); end++); } if (*end) { Modified: subversion/branches/performance/subversion/svnserve/log-escape.c URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/svnserve/log-escape.c?rev=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/svnserve/log-escape.c (original) +++ subversion/branches/performance/subversion/svnserve/log-escape.c Sun Aug 15 13:09:33 2010 @@ -40,10 +40,10 @@ #include <apr.h> -#include <apr_lib.h> #define APR_WANT_STRFUNC #include <apr_want.h> #include "server.h" +#include "svn_ctype.h" /* copied from httpd-2.2.4/server/util.c */ /* c2x takes an unsigned, and expects the caller has guaranteed that @@ -93,7 +93,9 @@ apr_size_t escape_errorlog_item(char *de which does this same check with a fast lookup table. Well, mostly the same; we don't escape quotes, as that does. */ - if (*s && (!apr_isprint(*s) || *s == '\\' || apr_iscntrl(*s))) { + if (*s && ( !svn_ctype_isprint(*s) + || *s == '\\' + || svn_ctype_iscntrl(*s))) { *d++ = '\\'; if (d >= ep) { --d; Modified: subversion/branches/performance/subversion/tests/libsvn_delta/delta-window-test.h URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/tests/libsvn_delta/delta-window-test.h?rev=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/tests/libsvn_delta/delta-window-test.h (original) +++ subversion/branches/performance/subversion/tests/libsvn_delta/delta-window-test.h Sun Aug 15 13:09:33 2010 @@ -26,9 +26,9 @@ #define APR_WANT_STDIO #define APR_WANT_STRFUNC #include <apr_want.h> -#include <apr_lib.h> #include "svn_delta.h" +#include "svn_ctype.h" static apr_off_t delta_window_size_estimate(const svn_txdelta_window_t *window) @@ -99,7 +99,7 @@ delta_window_print(const svn_txdelta_win for (tmp = offset; tmp < offset + length; ++tmp) { int const dat = window->new_data->data[tmp]; - if (apr_iscntrl(dat) || !apr_isascii(dat)) + if (svn_ctype_iscntrl(dat) || !svn_ctype_isascii(dat)) fprintf(stream, "\\%3.3o", dat & 0xff); else if (dat == '\\') fputs("\\\\", stream); Modified: subversion/branches/performance/subversion/tests/svn_test_main.c URL: http://svn.apache.org/viewvc/subversion/branches/performance/subversion/tests/svn_test_main.c?rev=985669&r1=985668&r2=985669&view=diff ============================================================================== --- subversion/branches/performance/subversion/tests/svn_test_main.c (original) +++ subversion/branches/performance/subversion/tests/svn_test_main.c Sun Aug 15 13:09:33 2010 @@ -29,7 +29,6 @@ #include <apr_pools.h> #include <apr_general.h> -#include <apr_lib.h> #include "svn_cmdline.h" #include "svn_opt.h" @@ -38,6 +37,7 @@ #include "svn_test.h" #include "svn_io.h" #include "svn_path.h" +#include "svn_ctype.h" #include "svn_private_config.h" @@ -262,7 +262,7 @@ do_test_num(const char *progname, printf("WARNING: Test docstring exceeds 50 characters\n"); if (msg[len - 1] == '.') printf("WARNING: Test docstring ends in a period (.)\n"); - if (apr_isupper(msg[0])) + if (svn_ctype_isupper(msg[0])) printf("WARNING: Test docstring is capitalized\n"); } if (desc->msg == NULL) @@ -425,7 +425,7 @@ main(int argc, const char *argv[]) { for (i = 1; i < argc; i++) { - if (apr_isdigit(argv[i][0])) + if (svn_ctype_isdigit(argv[i][0])) { ran_a_test = TRUE; test_num = atoi(argv[i]);