[Pcre-svn] [987] code/trunk: Remove unused character flag c…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [987] code/trunk: Remove unused character flag ctype_meta, no longer used.
Revision: 987
          http://www.exim.org/viewvc/pcre2?view=rev&revision=987
Author:   ph10
Date:     2018-08-19 16:44:06 +0100 (Sun, 19 Aug 2018)
Log Message:
-----------
Remove unused character flag ctype_meta, no longer used.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/dftables.c
    code/trunk/src/pcre2_internal.h
    code/trunk/src/pcre2_maketables.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2018-08-17 14:45:35 UTC (rev 986)
+++ code/trunk/ChangeLog    2018-08-19 15:44:06 UTC (rev 987)
@@ -165,7 +165,10 @@
 with only characters less than 0x100, the first class was incorrectly being 
 auto-possessified, causing incorrect match failures.


+36. Removed the character type bit ctype_meta, which dates from PCRE1 and is
+not used in PCRE2.

+
Version 10.31 12-February-2018
------------------------------


Modified: code/trunk/src/dftables.c
===================================================================
--- code/trunk/src/dftables.c    2018-08-17 14:45:35 UTC (rev 986)
+++ code/trunk/src/dftables.c    2018-08-19 15:44:06 UTC (rev 987)
@@ -7,7 +7,7 @@


                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-         New API code Copyright (c) 2016 University of Cambridge
+          New API code Copyright (c) 2016-2018 University of Cambridge


-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -104,6 +104,14 @@
"tables are passed to PCRE2 by the application that calls it. The tables\n"
"are used only for characters whose code values are less than 256. */\n\n");

+fprintf(f,
+ "/*The dftables program (which is distributed with PCRE2) can be used to\n"
+ "build alternative versions of this file. This is necessary if you are\n"
+ "running in an EBCDIC environment, or if you want to default to a different\n"
+ "encoding, for example ISO-8859-1. When dftables is run, it creates these\n"
+ "tables in the current locale. This happens automatically if PCRE2 is\n"
+ "configured with --enable-rebuild-chartables. */\n\n");
+
/* Force config.h in z/OS */

#if defined NATIVE_ZOS
@@ -115,7 +123,7 @@
#endif

fprintf(f,
- "/* The following #includes are present because without them gcc 4.x may remove\n"
+ "/* The following #include is present because without it gcc 4.x may remove\n"
"the array definition from the final binary if PCRE2 is built into a static\n"
"library and dead code stripping is activated. This leads to link errors.\n"
"Pulling in the header ensures that the array gets flagged as \"someone\n"
@@ -153,11 +161,10 @@
fprintf(f, ",\n\n");

fprintf(f,
- "/* This table contains bit maps for various character classes.\n"
- "Each map is 32 bytes long and the bits run from the least\n"
- "significant end of each byte. The classes that have their own\n"
- "maps are: space, xdigit, digit, upper, lower, word, graph\n"
- "print, punct, and cntrl. Other classes are built from combinations. */\n\n");
+ "/* This table contains bit maps for various character classes. Each map is 32\n"
+ "bytes long and the bits run from the least significant end of each byte. The\n"
+ "classes that have their own maps are: space, xdigit, digit, upper, lower, word,\n"
+ "graph print, punct, and cntrl. Other classes are built from combinations. */\n\n");

fprintf(f, " ");
for (i = 0; i < cbit_length; i++)
@@ -178,10 +185,8 @@
" 0x%02x letter\n"
" 0x%02x decimal digit\n"
" 0x%02x hexadecimal digit\n"
- " 0x%02x alphanumeric or '_'\n"
- " 0x%02x regular expression metacharacter or binary zero\n*/\n\n",
- ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word,
- ctype_meta);
+ " 0x%02x alphanumeric or '_'\n*/\n\n",
+ ctype_space, ctype_letter, ctype_digit, ctype_xdigit, ctype_word);

fprintf(f, " ");
for (i = 0; i < 256; i++)

Modified: code/trunk/src/pcre2_internal.h
===================================================================
--- code/trunk/src/pcre2_internal.h    2018-08-17 14:45:35 UTC (rev 986)
+++ code/trunk/src/pcre2_internal.h    2018-08-19 15:44:06 UTC (rev 987)
@@ -565,14 +565,15 @@
 #define cbit_cntrl   288      /* [:cntrl:] */
 #define cbit_length  320      /* Length of the cbits table */


-/* Bit definitions for entries in the ctypes table. */
+/* Bit definitions for entries in the ctypes table. Do not change these values
+without checking pcre2_jit_compile.c, which has an assertion to ensure that
+ctype_word has the value 16. */

 #define ctype_space   0x01
 #define ctype_letter  0x02
 #define ctype_digit   0x04
-#define ctype_xdigit  0x08
+#define ctype_xdigit  0x08    /* not actually used any more */
 #define ctype_word    0x10    /* alphanumeric or '_' */
-#define ctype_meta    0x80    /* regexp meta char or zero (end pattern) */


/* Offsets of the various tables from the base tables pointer, and
total length of the tables. */

Modified: code/trunk/src/pcre2_maketables.c
===================================================================
--- code/trunk/src/pcre2_maketables.c    2018-08-17 14:45:35 UTC (rev 986)
+++ code/trunk/src/pcre2_maketables.c    2018-08-19 15:44:06 UTC (rev 987)
@@ -7,7 +7,7 @@


                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-         New API code Copyright (c) 2016 University of Cambridge
+          New API code Copyright (c) 2016-2018 University of Cambridge


-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -141,13 +141,6 @@
if (isdigit(i)) x += ctype_digit;
if (isxdigit(i)) x += ctype_xdigit;
if (isalnum(i) || i == '_') x += ctype_word;
-
- /* Note: strchr includes the terminating zero in the characters it considers.
- In this instance, that is ok because we want binary zero to be flagged as a
- meta-character, which in this sense is any character that terminates a run
- of data characters. */
-
- if (strchr("\\*+?{^.$|()[", i) != 0) x += ctype_meta;
*p++ = x;
}