]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.1175 v7.3.1175
authorBram Moolenaar <Bram@vim.org>
Wed, 12 Jun 2013 15:12:24 +0000 (17:12 +0200)
committerBram Moolenaar <Bram@vim.org>
Wed, 12 Jun 2013 15:12:24 +0000 (17:12 +0200)
Problem:    Using isalpha() and isalnum() can be slow.
Solution:   Use range checks. (Mike Williams)

src/ex_docmd.c
src/macros.h
src/version.c

index 3efb3814b583952688346e05b91b9ee6c20695f7..fe711d79d30441eb5ac996cb8081bc269c2069ab 100644 (file)
@@ -3120,7 +3120,7 @@ modifier_len(cmd)
        for (j = 0; p[j] != NUL; ++j)
            if (p[j] != cmdmods[i].name[j])
                break;
-       if (!isalpha(p[j]) && j >= cmdmods[i].minlen
+       if (!ASCII_ISALPHA(p[j]) && j >= cmdmods[i].minlen
                                        && (p == cmd || cmdmods[i].has_count))
            return j + (int)(p - cmd);
     }
index 2c305ce1d20d72f3cdd1342b2c3141f8f737008e..f4a068cfb9698f44a7226cbbb1a716c7a13ca5a9 100644 (file)
 # define MB_TOUPPER(c) TOUPPER_LOC(c)
 #endif
 
+/* Use our own isdigit() replacement, because on MS-Windows isdigit() returns
+ * non-zero for superscript 1.  Also avoids that isdigit() crashes for numbers
+ * below 0 and above 255.  */
+#define VIM_ISDIGIT(c) ((unsigned)(c) - '0' < 10)
+
 /* Like isalpha() but reject non-ASCII characters.  Can't be used with a
  * special key (negative value). */
 #ifdef EBCDIC
 # define ASCII_ISLOWER(c) islower(c)
 # define ASCII_ISUPPER(c) isupper(c)
 #else
-# define ASCII_ISALPHA(c) ((c) < 0x7f && isalpha(c))
-# define ASCII_ISALNUM(c) ((c) < 0x7f && isalnum(c))
 # define ASCII_ISLOWER(c) ((unsigned)(c) - 'a' < 26)
 # define ASCII_ISUPPER(c) ((unsigned)(c) - 'A' < 26)
+# define ASCII_ISALPHA(c) (ASCII_ISUPPER(c) || ASCII_ISLOWER(c))
+# define ASCII_ISALNUM(c) (ASCII_ISALPHA(c) || VIM_ISDIGIT(c))
 #endif
 
-/* Use our own isdigit() replacement, because on MS-Windows isdigit() returns
- * non-zero for superscript 1.  Also avoids that isdigit() crashes for numbers
- * below 0 and above 255.  */
-#define VIM_ISDIGIT(c) ((unsigned)(c) - '0' < 10)
-
 /* macro version of chartab().
  * Only works with values 0-255!
  * Doesn't work for UTF-8 mode with chars >= 0x80. */
index e30bffe5d1d442b528626296444c1b41d9e239ef..fbd69b941e4cb68199d0e13d13051e6cf0ca5520 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1175,
 /**/
     1174,
 /**/