summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2018-08-19 16:54:41 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2018-08-19 16:54:41 +0000
commit55b03bcb7e7e56d89288733656b59dd95320fe55 (patch)
treea5b8a99c3e99f49ffbb7b99bfefb26f8f273d149
parent36271bd0ac7e07fbb9ac1e190d5e9cf771cb34d6 (diff)
downloadpcre2-55b03bcb7e7e56d89288733656b59dd95320fe55.tar.gz
Tidy unnecessarily complicated macros in escapes table.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@989 6239d852-aaf2-0410-a92c-79f79f948069
-rw-r--r--ChangeLog2
-rw-r--r--src/pcre2_compile.c44
-rw-r--r--src/pcre2_internal.h34
3 files changed, 26 insertions, 54 deletions
diff --git a/ChangeLog b/ChangeLog
index 117ed5c..f4e62fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -168,6 +168,8 @@ auto-possessified, causing incorrect match failures.
36. Removed the character type bit ctype_meta, which dates from PCRE1 and is
not used in PCRE2.
+37. Tidied up unnecessarily complicated macros used in the escapes table.
+
Version 10.31 12-February-2018
------------------------------
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index 9631f37..8c30064 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -512,17 +512,17 @@ static const short int escapes[] = {
-ESC_Z, CHAR_LEFT_SQUARE_BRACKET,
CHAR_BACKSLASH, CHAR_RIGHT_SQUARE_BRACKET,
CHAR_CIRCUMFLEX_ACCENT, CHAR_UNDERSCORE,
- CHAR_GRAVE_ACCENT, ESC_a,
+ CHAR_GRAVE_ACCENT, CHAR_BEL,
-ESC_b, 0,
- -ESC_d, ESC_e,
- ESC_f, 0,
+ -ESC_d, CHAR_ESC,
+ CHAR_FF, 0,
-ESC_h, 0,
0, -ESC_k,
0, 0,
- ESC_n, 0,
+ CHAR_LF, 0,
-ESC_p, 0,
- ESC_r, -ESC_s,
- ESC_tee, 0,
+ CHAR_CR, -ESC_s,
+ CHAR_HT, 0,
-ESC_v, -ESC_w,
0, 0,
-ESC_z
@@ -546,22 +546,22 @@ because it is defined as 'a', which of course picks up the ASCII value. */
#endif
static const short int escapes[] = {
-/* 80 */ ESC_a, -ESC_b, 0, -ESC_d, ESC_e, ESC_f, 0,
-/* 88 */-ESC_h, 0, 0, '{', 0, 0, 0, 0,
-/* 90 */ 0, 0, -ESC_k, 0, 0, ESC_n, 0, -ESC_p,
-/* 98 */ 0, ESC_r, 0, '}', 0, 0, 0, 0,
-/* A0 */ 0, '~', -ESC_s, ESC_tee, 0,-ESC_v, -ESC_w, 0,
-/* A8 */ 0,-ESC_z, 0, 0, 0, '[', 0, 0,
-/* B0 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* B8 */ 0, 0, 0, 0, 0, ']', '=', '-',
-/* C0 */ '{',-ESC_A, -ESC_B, -ESC_C, -ESC_D,-ESC_E, 0, -ESC_G,
-/* C8 */-ESC_H, 0, 0, 0, 0, 0, 0, 0,
-/* D0 */ '}', 0, -ESC_K, 0, 0,-ESC_N, 0, -ESC_P,
-/* D8 */-ESC_Q,-ESC_R, 0, 0, 0, 0, 0, 0,
-/* E0 */ '\\', 0, -ESC_S, 0, 0,-ESC_V, -ESC_W, -ESC_X,
-/* E8 */ 0,-ESC_Z, 0, 0, 0, 0, 0, 0,
-/* F0 */ 0, 0, 0, 0, 0, 0, 0, 0,
-/* F8 */ 0, 0
+/* 80 */ CHAR_BEL, -ESC_b, 0, -ESC_d, CHAR_ESC, CHAR_FF, 0,
+/* 88 */ -ESC_h, 0, 0, '{', 0, 0, 0, 0,
+/* 90 */ 0, 0, -ESC_k, 0, 0, CHAR_LF, 0, -ESC_p,
+/* 98 */ 0, CHAR_CR, 0, '}', 0, 0, 0, 0,
+/* A0 */ 0, '~', -ESC_s, CHAR_HT, 0, -ESC_v, -ESC_w, 0,
+/* A8 */ 0, -ESC_z, 0, 0, 0, '[', 0, 0,
+/* B0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+/* B8 */ 0, 0, 0, 0, 0, ']', '=', '-',
+/* C0 */ '{', -ESC_A, -ESC_B, -ESC_C, -ESC_D, -ESC_E, 0, -ESC_G,
+/* C8 */ -ESC_H, 0, 0, 0, 0, 0, 0, 0,
+/* D0 */ '}', 0, -ESC_K, 0, 0, -ESC_N, 0, -ESC_P,
+/* D8 */ -ESC_Q, -ESC_R, 0, 0, 0, 0, 0, 0,
+/* E0 */ '\\', 0, -ESC_S, 0, 0, -ESC_V, -ESC_W, -ESC_X,
+/* E8 */ 0, -ESC_Z, 0, 0, 0, 0, 0, 0,
+/* F0 */ 0, 0, 0, 0, 0, 0, 0, 0,
+/* F8 */ 0, 0
};
/* We also need a table of characters that may follow \c in an EBCDIC
diff --git a/src/pcre2_internal.h b/src/pcre2_internal.h
index e754ae4..8750f2f 100644
--- a/src/pcre2_internal.h
+++ b/src/pcre2_internal.h
@@ -565,8 +565,8 @@ these tables. */
#define cbit_cntrl 288 /* [:cntrl:] */
#define cbit_length 320 /* Length of the cbits 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
+/* 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
@@ -1248,36 +1248,6 @@ contain characters with values greater than 255. */
#define XCL_PROP 3 /* Unicode property (2-byte property code follows) */
#define XCL_NOTPROP 4 /* Unicode inverted property (ditto) */
-/* Escape items that are just an encoding of a particular data value. These
-appear in the escapes[] table in pcre2_compile.c as positive numbers. */
-
-#ifndef ESC_a
-#define ESC_a CHAR_BEL
-#endif
-
-#ifndef ESC_e
-#define ESC_e CHAR_ESC
-#endif
-
-#ifndef ESC_f
-#define ESC_f CHAR_FF
-#endif
-
-#ifndef ESC_n
-#define ESC_n CHAR_LF
-#endif
-
-#ifndef ESC_r
-#define ESC_r CHAR_CR
-#endif
-
-/* We can't officially use ESC_t because it is a POSIX reserved identifier
-(presumably because of all the others like size_t). */
-
-#ifndef ESC_tee
-#define ESC_tee CHAR_HT
-#endif
-
/* These are escaped items that aren't just an encoding of a particular data
value such as \n. They must have non-zero values, as check_escape() returns 0
for a data character. In the escapes[] table in pcre2_compile.c their values