summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2014-11-03 17:13:00 +0000
committerph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>2014-11-03 17:13:00 +0000
commitdbde828d9540f7373f1f5d9fbf17880b9e045f7d (patch)
tree73924eb053b8b29cb91070334079138b58808645 /src
parent6a8bc7690a3773eef65bba413c1d5563f3bd63e8 (diff)
downloadpcre2-dbde828d9540f7373f1f5d9fbf17880b9e045f7d.tar.gz
Changed jit_stack_alloc to jit_stack_create.
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@131 6239d852-aaf2-0410-a92c-79f79f948069
Diffstat (limited to 'src')
-rw-r--r--src/pcre2.h.generic233
-rw-r--r--src/pcre2.h.in4
-rw-r--r--src/pcre2_compile.c6
-rw-r--r--src/pcre2_error.c2
-rw-r--r--src/pcre2_jit_misc.c2
-rw-r--r--src/pcre2_jit_test.c6
-rw-r--r--src/pcre2_substring.c2
-rw-r--r--src/pcre2grep.c2
-rw-r--r--src/pcre2test.c52
9 files changed, 150 insertions, 159 deletions
diff --git a/src/pcre2.h.generic b/src/pcre2.h.generic
index 3d7c9fd..724bb33 100644
--- a/src/pcre2.h.generic
+++ b/src/pcre2.h.generic
@@ -86,8 +86,7 @@ passed. Put these bits at the most significant end of the options word so
others can be added next to them */
#define PCRE2_ANCHORED 0x80000000u
-#define PCRE2_NO_START_OPTIMIZE 0x40000000u
-#define PCRE2_NO_UTF_CHECK 0x20000000u
+#define PCRE2_NO_UTF_CHECK 0x40000000u
/* Other options that can be passed to pcre2_compile(). They may affect
compilation, JIT compilation, and/or interpretive execution. The following tags
@@ -95,7 +94,7 @@ indicate which:
C alters what is compiled
J alters what JIT compiles
-E is inspected during pcre2_match() execution
+M is inspected during pcre2_match() execution
D is inspected during pcre2_dfa_match() execution
*/
@@ -103,24 +102,25 @@ D is inspected during pcre2_dfa_match() execution
#define PCRE2_ALT_BSUX 0x00000002u /* C */
#define PCRE2_AUTO_CALLOUT 0x00000004u /* C */
#define PCRE2_CASELESS 0x00000008u /* C */
-#define PCRE2_DOLLAR_ENDONLY 0x00000010u /* J E D */
+#define PCRE2_DOLLAR_ENDONLY 0x00000010u /* J M D */
#define PCRE2_DOTALL 0x00000020u /* C */
#define PCRE2_DUPNAMES 0x00000040u /* C */
#define PCRE2_EXTENDED 0x00000080u /* C */
-#define PCRE2_FIRSTLINE 0x00000100u /* J E D */
-#define PCRE2_MATCH_UNSET_BACKREF 0x00000200u /* C J E */
+#define PCRE2_FIRSTLINE 0x00000100u /* J M D */
+#define PCRE2_MATCH_UNSET_BACKREF 0x00000200u /* C J M */
#define PCRE2_MULTILINE 0x00000400u /* C */
#define PCRE2_NEVER_UCP 0x00000800u /* C */
#define PCRE2_NEVER_UTF 0x00001000u /* C */
#define PCRE2_NO_AUTO_CAPTURE 0x00002000u /* C */
#define PCRE2_NO_AUTO_POSSESS 0x00004000u /* C */
-#define PCRE2_UCP 0x00008000u /* C J E D */
-#define PCRE2_UNGREEDY 0x00010000u /* C */
-#define PCRE2_UTF 0x00020000u /* C J E D */
+#define PCRE2_NO_START_OPTIMIZE 0x00008000u /* J M D */
+#define PCRE2_UCP 0x00010000u /* C J M D */
+#define PCRE2_UNGREEDY 0x00020000u /* C */
+#define PCRE2_UTF 0x00040000u /* C J M D */
/* These are for pcre2_jit_compile(). */
-#define PCRE2_JIT 0x00000001u /* For full matching */
+#define PCRE2_JIT_COMPLETE 0x00000001u /* For full matching */
#define PCRE2_JIT_PARTIAL_SOFT 0x00000002u
#define PCRE2_JIT_PARTIAL_HARD 0x00000004u
@@ -130,8 +130,8 @@ functions, so take care not to define synonyms by mistake. */
#define PCRE2_NOTBOL 0x00000001u
#define PCRE2_NOTEOL 0x00000002u
-#define PCRE2_NOTEMPTY 0x00000004u
-#define PCRE2_NOTEMPTY_ATSTART 0x00000008u
+#define PCRE2_NOTEMPTY 0x00000004u /* ) These two must be kept */
+#define PCRE2_NOTEMPTY_ATSTART 0x00000008u /* ) adjacent to each other. */
#define PCRE2_PARTIAL_SOFT 0x00000010u
#define PCRE2_PARTIAL_HARD 0x00000020u
@@ -140,9 +140,9 @@ functions, so take care not to define synonyms by mistake. */
#define PCRE2_DFA_RESTART 0x00000040u
#define PCRE2_DFA_SHORTEST 0x00000080u
-/* Newline and \R settings, for use in the compile and match contexts. The
-newline values must be kept in step with values set in config.h and both sets
-must all be greater than zero. */
+/* Newline and \R settings, for use in compile contexts. The newline values
+must be kept in step with values set in config.h and both sets must all be
+greater than zero. */
#define PCRE2_NEWLINE_CR 1
#define PCRE2_NEWLINE_LF 2
@@ -193,32 +193,33 @@ must all be greater than zero. */
#define PCRE2_ERROR_UTF32_ERR1 (-27)
#define PCRE2_ERROR_UTF32_ERR2 (-28)
-/* Error codes for pcre2[_dfa]_match() */
-
-#define PCRE2_ERROR_BADCOUNT (-29)
-#define PCRE2_ERROR_BADENDIANNESS (-30)
-#define PCRE2_ERROR_BADLENGTH (-31)
-#define PCRE2_ERROR_BADMAGIC (-32)
-#define PCRE2_ERROR_BADMODE (-33)
-#define PCRE2_ERROR_BADOFFSET (-34)
-#define PCRE2_ERROR_BADOPTION (-35)
-#define PCRE2_ERROR_BADUTFOFFSET (-36)
-#define PCRE2_ERROR_CALLOUT (-37) /* Never used by PCRE2 itself */
-#define PCRE2_ERROR_DFA_BADRESTART (-38)
-#define PCRE2_ERROR_DFA_RECURSE (-39)
-#define PCRE2_ERROR_DFA_UCOND (-40)
-#define PCRE2_ERROR_DFA_UITEM (-41)
-#define PCRE2_ERROR_DFA_UMLIMIT (-42)
-#define PCRE2_ERROR_DFA_WSSIZE (-43)
-#define PCRE2_ERROR_INTERNAL (-44)
-#define PCRE2_ERROR_JIT_BADOPTION (-45)
-#define PCRE2_ERROR_JIT_STACKLIMIT (-46)
-#define PCRE2_ERROR_MATCHLIMIT (-47)
-#define PCRE2_ERROR_NOMEMORY (-48)
-#define PCRE2_ERROR_NOSUBSTRING (-49)
-#define PCRE2_ERROR_NULL (-50)
-#define PCRE2_ERROR_RECURSELOOP (-51)
-#define PCRE2_ERROR_RECURSIONLIMIT (-52)
+/* Error codes for pcre2[_dfa]_match(), substring extraction functions, and
+context functions. */
+
+#define PCRE2_ERROR_BADDATA (-29)
+#define PCRE2_ERROR_BADLENGTH (-30)
+#define PCRE2_ERROR_BADMAGIC (-31)
+#define PCRE2_ERROR_BADMODE (-32)
+#define PCRE2_ERROR_BADOFFSET (-33)
+#define PCRE2_ERROR_BADOPTION (-34)
+#define PCRE2_ERROR_BADUTFOFFSET (-35)
+#define PCRE2_ERROR_CALLOUT (-36) /* Never used by PCRE2 itself */
+#define PCRE2_ERROR_DFA_BADRESTART (-37)
+#define PCRE2_ERROR_DFA_RECURSE (-38)
+#define PCRE2_ERROR_DFA_UCOND (-39)
+#define PCRE2_ERROR_DFA_UITEM (-40)
+#define PCRE2_ERROR_DFA_WSSIZE (-41)
+#define PCRE2_ERROR_INTERNAL (-42)
+#define PCRE2_ERROR_JIT_BADOPTION (-43)
+#define PCRE2_ERROR_JIT_STACKLIMIT (-44)
+#define PCRE2_ERROR_MATCHLIMIT (-45)
+#define PCRE2_ERROR_NOMEMORY (-46)
+#define PCRE2_ERROR_NOSUBSTRING (-47)
+#define PCRE2_ERROR_NOUNIQUESUBSTRING (-48)
+#define PCRE2_ERROR_NULL (-49)
+#define PCRE2_ERROR_RECURSELOOP (-50)
+#define PCRE2_ERROR_RECURSIONLIMIT (-51)
+#define PCRE2_ERROR_UNSET (-52)
/* Request types for pcre2_pattern_info() */
@@ -257,8 +258,8 @@ must all be greater than zero. */
#define PCRE2_CONFIG_PARENSLIMIT 7
#define PCRE2_CONFIG_RECURSIONLIMIT 5
#define PCRE2_CONFIG_STACKRECURSE 8
-#define PCRE2_CONFIG_UNICODE_VERSION 9
-#define PCRE2_CONFIG_UTF 10
+#define PCRE2_CONFIG_UNICODE 9
+#define PCRE2_CONFIG_UNICODE_VERSION 10
#define PCRE2_CONFIG_VERSION 11
/* Types for code units in patterns and subject strings. */
@@ -271,12 +272,14 @@ typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
-/* Offsets in the pattern (for errors) and in the subject (after a match) are
-unsigned 32-bit numbers. We also define a value to indicate "unset" in the
-offset vector (ovector). */
+/* The PCRE2_SIZE type is used for all string lengths and offsets in PCRE2,
+including pattern offsets for errors and subject offsets after a match. We
+define special values to indicate zero-terminated strings and unset offsets in
+the offset vector (ovector). */
-#define PCRE2_OFFSET PCRE2_UCHAR32
-#define PCRE2_UNSET (~(PCRE2_OFFSET)0)
+#define PCRE2_SIZE size_t
+#define PCRE2_ZERO_TERMINATED (~(PCRE2_SIZE)0)
+#define PCRE2_UNSET (~(PCRE2_SIZE)0)
/* Generic types for opaque structures and JIT callback functions. These
declarations are defined in a macro that is expanded for each width later. */
@@ -311,22 +314,20 @@ versions are generated from this macro below. */
#define PCRE2_STRUCTURE_LIST \
typedef struct pcre2_callout_block { \
- int version; /* Identifies version of block */ \
+ uint32_t version; /* Identifies version of block */ \
/* ------------------------ Version 0 ------------------------------- */ \
uint32_t callout_number; /* Number compiled into pattern */ \
- PCRE2_OFFSET *offset_vector; /* The offset vector */ \
- PCRE2_SPTR subject; /* The subject being matched */ \
- size_t subject_length; /* The length of the subject */ \
- PCRE2_OFFSET start_match; /* Offset to start of this match attempt */ \
- PCRE2_OFFSET current_position; /* Where we currently are in the subject */ \
uint32_t capture_top; /* Max current capture */ \
uint32_t capture_last; /* Most recently closed capture */ \
void *callout_data; /* Data passed in with the call */ \
- /* ------------------- Added for Version 1 -------------------------- */ \
- PCRE2_OFFSET pattern_position; /* Offset to next item in the pattern */ \
- PCRE2_OFFSET next_item_length; /* Length of next item in the pattern */ \
- /* ------------------- Added for Version 2 -------------------------- */ \
- PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
+ PCRE2_SIZE *offset_vector; /* The offset vector */ \
+ PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
+ PCRE2_SPTR subject; /* The subject being matched */ \
+ PCRE2_SIZE subject_length; /* The length of the subject */ \
+ PCRE2_SIZE start_match; /* Offset to start of this match attempt */ \
+ PCRE2_SIZE current_position; /* Where we currently are in the subject */ \
+ PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \
+ PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \
/* ------------------------------------------------------------------ */ \
} pcre2_callout_block;
@@ -336,7 +337,7 @@ expanded for each width below. Start with functions that give general
information. */
#define PCRE2_GENERAL_INFO_FUNCTIONS \
-PCRE2_EXP_DECL int pcre2_config(int, void *, size_t);
+PCRE2_EXP_DECL int pcre2_config(uint32_t, void *);
/* Functions for manipulating contexts. */
@@ -346,7 +347,7 @@ PCRE2_EXP_DECL \
pcre2_general_context *pcre2_general_context_copy(pcre2_general_context *); \
PCRE2_EXP_DECL \
pcre2_general_context *pcre2_general_context_create( \
- void *(*)(size_t, void *), \
+ void *(*)(PCRE2_SIZE, void *), \
void (*)(void *, void *), void *); \
PCRE2_EXP_DECL void pcre2_general_context_free(pcre2_general_context *);
@@ -356,12 +357,10 @@ PCRE2_EXP_DECL \
PCRE2_EXP_DECL \
pcre2_compile_context *pcre2_compile_context_create(pcre2_general_context *);\
PCRE2_EXP_DECL void pcre2_compile_context_free(pcre2_compile_context *); \
-PCRE2_EXP_DECL int pcre2_set_bsr_compile(pcre2_compile_context *, \
- uint32_t); \
+PCRE2_EXP_DECL int pcre2_set_bsr(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_character_tables(pcre2_compile_context *, \
const unsigned char *); \
-PCRE2_EXP_DECL int pcre2_set_newline_compile(pcre2_compile_context *, \
- uint32_t); \
+PCRE2_EXP_DECL int pcre2_set_newline(pcre2_compile_context *, uint32_t); \
PCRE2_EXP_DECL int pcre2_set_parens_nest_limit(pcre2_compile_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_compile_recursion_guard(\
@@ -373,18 +372,14 @@ PCRE2_EXP_DECL \
PCRE2_EXP_DECL \
pcre2_match_context *pcre2_match_context_create(pcre2_general_context *); \
PCRE2_EXP_DECL void pcre2_match_context_free(pcre2_match_context *); \
-PCRE2_EXP_DECL int pcre2_set_bsr_match(pcre2_match_context *, \
- uint32_t); \
PCRE2_EXP_DECL int pcre2_set_callout(pcre2_match_context *, \
int (*)(pcre2_callout_block *), void *); \
PCRE2_EXP_DECL int pcre2_set_match_limit(pcre2_match_context *, \
uint32_t); \
-PCRE2_EXP_DECL int pcre2_set_newline_match(pcre2_match_context *, \
- uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_match_context *, \
uint32_t); \
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
- pcre2_match_context *, void *(*)(size_t, void *), \
+ pcre2_match_context *, void *(*)(PCRE2_SIZE, void *), \
void (*)(void *, void *), void *);
@@ -392,8 +387,8 @@ PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
#define PCRE2_COMPILE_FUNCTIONS \
PCRE2_EXP_DECL \
- pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
- int *, PCRE2_OFFSET *, pcre2_compile_context *); \
+ pcre2_code *pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, \
+ int *, PCRE2_SIZE *, pcre2_compile_context *); \
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
@@ -408,65 +403,62 @@ PCRE2_EXP_DECL int pcre2_pattern_info(const pcre2_code *, uint32_t, \
#define PCRE2_MATCH_FUNCTIONS \
PCRE2_EXP_DECL \
- pcre2_match_data *pcre2_match_data_create(uint32_t, \
- pcre2_general_context *); \
+ pcre2_match_data *pcre2_match_data_create(uint32_t, \
+ pcre2_general_context *); \
PCRE2_EXP_DECL \
- pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
- pcre2_general_context *); \
-PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
- PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
- pcre2_match_data *, pcre2_match_context *, int *, \
- size_t); \
-PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
- PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
- pcre2_match_data *, pcre2_match_context *); \
-PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
-PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_leftchar(pcre2_match_data *); \
-PCRE2_EXP_DECL PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
-PCRE2_EXP_DECL uint32_t pcre2_get_ovector_count(pcre2_match_data *); \
-PCRE2_EXP_DECL PCRE2_OFFSET *pcre2_get_ovector_pointer(pcre2_match_data *); \
-PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_rightchar(pcre2_match_data *); \
-PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_startchar(pcre2_match_data *);
+ pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
+ pcre2_general_context *); \
+PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, PCRE2_SPTR, \
+ PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
+ pcre2_match_data *, pcre2_match_context *, int *, \
+ PCRE2_SIZE); \
+PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
+ PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
+ pcre2_match_data *, pcre2_match_context *); \
+PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
+PCRE2_EXP_DECL PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
+PCRE2_EXP_DECL uint32_t pcre2_get_ovector_count(pcre2_match_data *); \
+PCRE2_EXP_DECL PCRE2_SIZE *pcre2_get_ovector_pointer(pcre2_match_data *); \
+PCRE2_EXP_DECL PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *);
/* Convenience functions for handling matched substrings. */
#define PCRE2_SUBSTRING_FUNCTIONS \
PCRE2_EXP_DECL int pcre2_substring_copy_byname(pcre2_match_data *, \
- PCRE2_SPTR, PCRE2_UCHAR *, size_t); \
+ PCRE2_SPTR, PCRE2_UCHAR *, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_copy_bynumber(pcre2_match_data *, \
- int, PCRE2_UCHAR *, size_t); \
+ unsigned int, PCRE2_UCHAR *, PCRE2_SIZE *); \
PCRE2_EXP_DECL void pcre2_substring_free(PCRE2_UCHAR *); \
PCRE2_EXP_DECL int pcre2_substring_get_byname(pcre2_match_data *, \
- PCRE2_SPTR, PCRE2_UCHAR **); \
+ PCRE2_SPTR, PCRE2_UCHAR **, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_get_bynumber(pcre2_match_data *, \
- int, PCRE2_UCHAR **); \
+ unsigned int, PCRE2_UCHAR **, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_length_byname(pcre2_match_data *, \
- PCRE2_SPTR); \
+ PCRE2_SPTR, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_length_bynumber(pcre2_match_data *, \
- int); \
+ unsigned int, PCRE2_SIZE *); \
PCRE2_EXP_DECL int pcre2_substring_nametable_scan(const pcre2_code *, \
PCRE2_SPTR, PCRE2_SPTR *, PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_substring_number_from_name(\
const pcre2_code *, PCRE2_SPTR); \
PCRE2_EXP_DECL void pcre2_substring_list_free(PCRE2_SPTR *); \
PCRE2_EXP_DECL int pcre2_substring_list_get(pcre2_match_data *, \
- PCRE2_UCHAR ***, size_t **);
+ PCRE2_UCHAR ***, PCRE2_SIZE **);
/* Functions for JIT processing */
#define PCRE2_JIT_FUNCTIONS \
-PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_code *, uint32_t, \
- pcre2_match_context *); \
+PCRE2_EXP_DECL int pcre2_jit_compile(pcre2_code *, uint32_t); \
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
- PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
+ PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, uint32_t, \
pcre2_match_data *, pcre2_match_context *, \
pcre2_jit_stack *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
PCRE2_EXP_DECL \
- pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_general_context *, \
- size_t, size_t); \
+ pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *, \
+ PCRE2_SIZE, PCRE2_SIZE); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(const pcre2_code *, \
pcre2_jit_callback, void *); \
PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);
@@ -475,7 +467,7 @@ PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);
/* Other miscellaneous functions. */
#define PCRE2_OTHER_FUNCTIONS \
-PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, size_t); \
+PCRE2_EXP_DECL int pcre2_get_error_message(int, PCRE2_UCHAR *, PCRE2_SIZE); \
PCRE2_EXP_DECL \
const uint8_t *pcre2_maketables(pcre2_general_context *); \
@@ -532,17 +524,15 @@ pcre2_compile are called by application code. */
#define pcre2_general_context_create PCRE2_SUFFIX(pcre2_general_context_create_)
#define pcre2_general_context_free PCRE2_SUFFIX(pcre2_general_context_free_)
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
-#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
#define pcre2_get_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
-#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
#define pcre2_get_startchar PCRE2_SUFFIX(pcre2_get_startchar_)
#define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_)
#define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_)
#define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
-#define pcre2_jit_stack_alloc PCRE2_SUFFIX(pcre2_jit_stack_alloc_)
#define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_)
+#define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_)
#define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
#define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
#define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
@@ -552,14 +542,12 @@ pcre2_compile are called by application code. */
#define pcre2_match_data_create_from_pattern PCRE2_SUFFIX(pcre2_match_data_create_from_pattern_)
#define pcre2_match_data_free PCRE2_SUFFIX(pcre2_match_data_free_)
#define pcre2_pattern_info PCRE2_SUFFIX(pcre2_pattern_info_)
-#define pcre2_set_bsr_compile PCRE2_SUFFIX(pcre2_set_bsr_compile_)
-#define pcre2_set_bsr_match PCRE2_SUFFIX(pcre2_set_bsr_match_)
+#define pcre2_set_bsr PCRE2_SUFFIX(pcre2_set_bsr_)
#define pcre2_set_callout PCRE2_SUFFIX(pcre2_set_callout_)
#define pcre2_set_character_tables PCRE2_SUFFIX(pcre2_set_character_tables_)
#define pcre2_set_compile_recursion_guard PCRE2_SUFFIX(pcre2_set_compile_recursion_guard_)
#define pcre2_set_match_limit PCRE2_SUFFIX(pcre2_set_match_limit_)
-#define pcre2_set_newline_compile PCRE2_SUFFIX(pcre2_set_newline_compile_)
-#define pcre2_set_newline_match PCRE2_SUFFIX(pcre2_set_newline_match_)
+#define pcre2_set_newline PCRE2_SUFFIX(pcre2_set_newline_)
#define pcre2_set_parens_nest_limit PCRE2_SUFFIX(pcre2_set_parens_nest_limit_)
#define pcre2_set_recursion_limit PCRE2_SUFFIX(pcre2_set_recursion_limit_)
#define pcre2_set_recursion_memory_management PCRE2_SUFFIX(pcre2_set_recursion_memory_management_)
@@ -621,24 +609,27 @@ PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
#undef PCRE2_OTHER_FUNCTIONS
#undef PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
-/* Re-define PCRE2_SUFFIX to use the external width value, if defined.
-Otherwise, undefine the other macros and make PCRE2_SUFFIX a no-op, to reduce
-confusion. */
+/* PCRE2_CODE_UNIT_WIDTH must be defined. If it is 8, 16, or 32, redefine
+PCRE2_SUFFIX to use it. If it is 0, undefine the other macros and make
+PCRE2_SUFFIX a no-op. Otherwise, generate an error. */
#undef PCRE2_SUFFIX
-#ifdef PCRE2_CODE_UNIT_WIDTH
-#if PCRE2_CODE_UNIT_WIDTH != 8 && \
- PCRE2_CODE_UNIT_WIDTH != 16 && \
- PCRE2_CODE_UNIT_WIDTH != 32
-#error PCRE2_CODE_UNIT_WIDTH must be 8, 16, or 32
-#endif
+#ifndef PCRE2_CODE_UNIT_WIDTH
+#error PCRE2_CODE_UNIT_WIDTH must be defined before including pcre2.h.
+#error Use 8, 16, or 32; or 0 for a multi-width application.
+#else /* PCRE2_CODE_UNIT_WIDTH is defined */
+#if PCRE2_CODE_UNIT_WIDTH == 8 || \
+ PCRE2_CODE_UNIT_WIDTH == 16 || \
+ PCRE2_CODE_UNIT_WIDTH == 32
#define PCRE2_SUFFIX(a) PCRE2_GLUE(a, PCRE2_CODE_UNIT_WIDTH)
-#else
+#elif PCRE2_CODE_UNIT_WIDTH == 0
#undef PCRE2_JOIN
#undef PCRE2_GLUE
#define PCRE2_SUFFIX(a) a
+#else
+#error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32.
#endif
-
+#endif /* PCRE2_CODE_UNIT_WIDTH is defined */
#ifdef __cplusplus
} /* extern "C" */
diff --git a/src/pcre2.h.in b/src/pcre2.h.in
index bbbf469..3fd32d9 100644
--- a/src/pcre2.h.in
+++ b/src/pcre2.h.in
@@ -457,7 +457,7 @@ PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
pcre2_jit_stack *); \
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
PCRE2_EXP_DECL \
- pcre2_jit_stack *pcre2_jit_stack_alloc(pcre2_general_context *, \
+ pcre2_jit_stack *pcre2_jit_stack_create(pcre2_general_context *, \
PCRE2_SIZE, PCRE2_SIZE); \
PCRE2_EXP_DECL void pcre2_jit_stack_assign(const pcre2_code *, \
pcre2_jit_callback, void *); \
@@ -531,8 +531,8 @@ pcre2_compile are called by application code. */
#define pcre2_jit_compile PCRE2_SUFFIX(pcre2_jit_compile_)
#define pcre2_jit_match PCRE2_SUFFIX(pcre2_jit_match_)
#define pcre2_jit_free_unused_memory PCRE2_SUFFIX(pcre2_jit_free_unused_memory_)
-#define pcre2_jit_stack_alloc PCRE2_SUFFIX(pcre2_jit_stack_alloc_)
#define pcre2_jit_stack_assign PCRE2_SUFFIX(pcre2_jit_stack_assign_)
+#define pcre2_jit_stack_create PCRE2_SUFFIX(pcre2_jit_stack_create_)
#define pcre2_jit_stack_free PCRE2_SUFFIX(pcre2_jit_stack_free_)
#define pcre2_maketables PCRE2_SUFFIX(pcre2_maketables_)
#define pcre2_match_context_copy PCRE2_SUFFIX(pcre2_match_context_copy_)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index c0dbe8a..b85cd5a 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -304,8 +304,8 @@ static const short int escapes[] = {
#else
/* This is the "abnormal" table for EBCDIC systems without UTF-8 support.
-It runs from 'a' to '9'. For some minimal testing of EBCDIC features, the code
-is sometimes compiled on an ASCII system. In this case, we must not use CHAR_a
+It runs from 'a' to '9'. For some minimal testing of EBCDIC features, the code
+is sometimes compiled on an ASCII system. In this case, we must not use CHAR_a
because it is defined as 'a', which of course picks up the ASCII value. */
#if 'a' == 0x81 /* Check for a real EBCDIC environment */
@@ -7786,7 +7786,7 @@ if (cb.hwm > cb.start_workspace)
NULL to indicate that forward references have been filled in. */
if (cb.workspace_size > COMPILE_WORK_SIZE)
- ccontext->memctl.free((void *)cb.start_workspace,
+ ccontext->memctl.free((void *)cb.start_workspace,
ccontext->memctl.memory_data);
cb.start_workspace = NULL;
diff --git a/src/pcre2_error.c b/src/pcre2_error.c
index d1a253d..45b25cd 100644
--- a/src/pcre2_error.c
+++ b/src/pcre2_error.c
@@ -221,7 +221,7 @@ static const char match_error_texts[] =
"match limit exceeded\0"
"no more memory\0"
"unknown or unset substring\0"
- "non-unique substring name\0"
+ "non-unique substring name\0"
"NULL argument passed\0"
/* 50 */
"nested recursion at the same subject position\0"
diff --git a/src/pcre2_jit_misc.c b/src/pcre2_jit_misc.c
index 2b6da8b..41c2d4c 100644
--- a/src/pcre2_jit_misc.c
+++ b/src/pcre2_jit_misc.c
@@ -97,7 +97,7 @@ sljit_free_unused_memory_exec();
*************************************************/
PCRE2_EXP_DEFN pcre2_jit_stack * PCRE2_CALL_CONVENTION
-pcre2_jit_stack_alloc(pcre2_general_context *gcontext, size_t startsize,
+pcre2_jit_stack_create(pcre2_general_context *gcontext, size_t startsize,
size_t maxsize)
{
#ifndef SUPPORT_JIT
diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c
index 54dba24..68e822c 100644
--- a/src/pcre2_jit_test.c
+++ b/src/pcre2_jit_test.c
@@ -854,7 +854,7 @@ static pcre2_jit_stack_8 *stack8;
static pcre2_jit_stack_8 *getstack8(void)
{
if (!stack8)
- stack8 = pcre2_jit_stack_alloc_8(NULL, 1, 1024 * 1024);
+ stack8 = pcre2_jit_stack_create_8(NULL, 1, 1024 * 1024);
return stack8;
}
@@ -877,7 +877,7 @@ static pcre2_jit_stack_16 *stack16;
static pcre2_jit_stack_16 *getstack16(void)
{
if (!stack16)
- stack16 = pcre2_jit_stack_alloc_16(NULL, 1, 1024 * 1024);
+ stack16 = pcre2_jit_stack_create_16(NULL, 1, 1024 * 1024);
return stack16;
}
@@ -900,7 +900,7 @@ static pcre2_jit_stack_32 *stack32;
static pcre2_jit_stack_32 *getstack32(void)
{
if (!stack32)
- stack32 = pcre2_jit_stack_alloc_32(NULL, 1, 1024 * 1024);
+ stack32 = pcre2_jit_stack_create_32(NULL, 1, 1024 * 1024);
return stack32;
}
diff --git a/src/pcre2_substring.c b/src/pcre2_substring.c
index 3faecd0..c4d67c1 100644
--- a/src/pcre2_substring.c
+++ b/src/pcre2_substring.c
@@ -446,7 +446,7 @@ while (top > bot)
if (PRIV(strcmp)(stringname, (last + entrysize + IMM2_SIZE)) != 0) break;
last += entrysize;
}
- if (firstptr == NULL)
+ if (firstptr == NULL)
return (first == last)? (int)GET2(entry, 0) : PCRE2_ERROR_NOUNIQUESUBSTRING;
*firstptr = first;
*lastptr = last;
diff --git a/src/pcre2grep.c b/src/pcre2grep.c
index ee374de..72259e8 100644
--- a/src/pcre2grep.c
+++ b/src/pcre2grep.c
@@ -3115,7 +3115,7 @@ for (fn = pattern_files; fn != NULL; fn = fn->next)
#ifdef SUPPORT_PCRE2GREP_JIT
if (use_jit)
- jit_stack = pcre2_jit_stack_alloc(NULL, 32*1024, 1024*1024);
+ jit_stack = pcre2_jit_stack_create(NULL, 32*1024, 1024*1024);
#endif
for (j = 1, cp = patterns; cp != NULL; j++, cp = cp->next)
diff --git a/src/pcre2test.c b/src/pcre2test.c
index 0c971c7..3850efd 100644
--- a/src/pcre2test.c
+++ b/src/pcre2test.c
@@ -88,7 +88,7 @@ that first, falling back to readline/readline.h. */
#endif
#endif
-/* Put the test for interactive input into a macro so that it can be changed if
+/* Put the test for interactive input into a macro so that it can be changed if
required for different environments. */
#define INTERACTIVE(f) isatty(fileno(f))
@@ -822,13 +822,13 @@ are supported. */
a = pcre2_jit_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),G(h,32), \
(pcre2_jit_stack_32 *)i)
-#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
+#define PCRE2_JIT_STACK_CREATE(a,b,c,d) \
if (test_mode == PCRE8_MODE) \
- a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_8(b,c,d); \
+ a = (PCRE2_JIT_STACK *)pcre2_jit_stack_create_8(b,c,d); \
else if (test_mode == PCRE16_MODE) \
- a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_16(b,c,d); \
+ a = (PCRE2_JIT_STACK *)pcre2_jit_stack_create_16(b,c,d); \
else \
- a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_32(b,c,d);
+ a = (PCRE2_JIT_STACK *)pcre2_jit_stack_create_32(b,c,d);
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
if (test_mode == PCRE8_MODE) \
@@ -1200,11 +1200,11 @@ the three different cases. */
a = G(pcre2_jit_match_,BITTWO)(G(b,BITTWO),(G(PCRE2_SPTR,BITTWO))c,d,e,f, \
G(g,BITTWO),G(h,BITTWO),(G(pcre2_jit_stack_,BITTWO) *)i)
-#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
+#define PCRE2_JIT_STACK_CREATE(a,b,c,d) \
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
- a = (PCRE2_JIT_STACK *)G(pcre2_jit_stack_alloc_,BITONE)(b,c,d); \
+ a = (PCRE2_JIT_STACK *)G(pcre2_jit_stack_create_,BITONE)(b,c,d); \
else \
- a = (PCRE2_JIT_STACK *)G(pcre2_jit_stack_alloc_,BITTWO)(b,c,d); \
+ a = (PCRE2_JIT_STACK *)G(pcre2_jit_stack_create_,BITTWO)(b,c,d); \
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
@@ -1447,8 +1447,8 @@ the three different cases. */
#define PCRE2_JIT_MATCH(a,b,c,d,e,f,g,h,(pcre2_jit_stack_8 *)i) \
a = pcre2_jit_match_8(G(b,8),(PCRE2_SPTR8)c,d,e,f,G(g,8),G(h,8), \
(pcre2_jit_stack_8 *)i)
-#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
- a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_8(b,c,d);
+#define PCRE2_JIT_STACK_CREATE(a,b,c,d) \
+ a = (PCRE2_JIT_STACK *)pcre2_jit_stack_create_8(b,c,d);
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
pcre2_jit_stack_assign_8(G(a,8),(pcre2_jit_callback_8)b,c);
#define PCRE2_JIT_STACK_FREE(a) pcre2_jit_stack_free_8((pcre2_jit_stack_8 *)a);
@@ -1526,8 +1526,8 @@ the three different cases. */
#define PCRE2_JIT_MATCH(a,b,c,d,e,f,g,h,i) \
a = pcre2_jit_match_16(G(b,16),(PCRE2_SPTR16)c,d,e,f,G(g,16),G(h,16), \
(pcre2_jit_stack_16 *)i)
-#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
- a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_16(b,c,d);
+#define PCRE2_JIT_STACK_CREATE(a,b,c,d) \
+ a = (PCRE2_JIT_STACK *)pcre2_jit_stack_create_16(b,c,d);
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
pcre2_jit_stack_assign_16(G(a,16),(pcre2_jit_callback_16)b,c);
#define PCRE2_JIT_STACK_FREE(a) pcre2_jit_stack_free_16((pcre2_jit_stack_16 *)a);
@@ -1605,8 +1605,8 @@ the three different cases. */
#define PCRE2_JIT_MATCH(a,b,c,d,e,f,g,h,i) \
a = pcre2_jit_match_32(G(b,32),(PCRE2_SPTR32)c,d,e,f,G(g,32),G(h,32), \
(pcre2_jit_stack_32 *)i)
-#define PCRE2_JIT_STACK_ALLOC(a,b,c,d) \
- a = (PCRE2_JIT_STACK *)pcre2_jit_stack_alloc_32(b,c,d);
+#define PCRE2_JIT_STACK_CREATE(a,b,c,d) \
+ a = (PCRE2_JIT_STACK *)pcre2_jit_stack_create_32(b,c,d);
#define PCRE2_JIT_STACK_ASSIGN(a,b,c) \
pcre2_jit_stack_assign_32(G(a,32),(pcre2_jit_callback_32)b,c);
#define PCRE2_JIT_STACK_FREE(a) pcre2_jit_stack_free_32((pcre2_jit_stack_32 *)a);
@@ -3681,7 +3681,7 @@ if (!decode_modifiers(p, CTX_PAT, &pat_patctl, NULL)) return PR_SKIP;
/* Assume full JIT compile for jitverify and/or jitfast if nothing else was
specified. */
-if (pat_patctl.jit == 0 &&
+if (pat_patctl.jit == 0 &&
(pat_patctl.control & (CTL_JITVERIFY|CTL_JITFAST)) != 0)
pat_patctl.jit = 7;
utf = (pat_patctl.options & PCRE2_UTF) != 0;
@@ -3996,7 +3996,7 @@ for (;;)
if ((pat_patctl.control & CTL_JITFAST) != 0)
PCRE2_JIT_MATCH(capcount, compiled_code, pp, ulen, dat_datctl.offset,
dat_datctl.options, match_data, dat_context, jit_stack);
- else
+ else
PCRE2_MATCH(capcount, compiled_code, pp, ulen, dat_datctl.offset,
dat_datctl.options, match_data, dat_context);
@@ -4637,7 +4637,7 @@ if (dat_datctl.jitstack != 0)
if (dat_datctl.jitstack != jit_stack_size)
{
PCRE2_JIT_STACK_FREE(jit_stack);
- PCRE2_JIT_STACK_ALLOC(jit_stack, NULL, 1, dat_datctl.jitstack * 1024);
+ PCRE2_JIT_STACK_CREATE(jit_stack, NULL, 1, dat_datctl.jitstack * 1024);
jit_stack_size = dat_datctl.jitstack;
}
PCRE2_JIT_STACK_ASSIGN(compiled_code, jit_callback, jit_stack);
@@ -4690,10 +4690,10 @@ for (gmatched = 0;; gmatched++)
PCRE2_SIZE ovecsave[2];
ovector = FLD(match_data, ovector);
-
+
/* When matching is via pcre2_match(), we will detect the use of JIT via the
stack callback function. */
-
+
jit_was_used = (pat_patctl.control & CTL_JITFAST) != 0;
/* After the first time round a global loop, save the current ovector[0,1] so
@@ -4722,7 +4722,7 @@ for (gmatched = 0;; gmatched++)
}
if (dfa_workspace == NULL)
dfa_workspace = (int *)malloc(DFA_WS_DIMENSION*sizeof(int));
- start_time = clock();
+ start_time = clock();
for (i = 0; i < timeitm; i++)
{
PCRE2_DFA_MATCH(capcount, compiled_code, pp, ulen,
@@ -4730,7 +4730,7 @@ for (gmatched = 0;; gmatched++)
dat_context, dfa_workspace, DFA_WS_DIMENSION);
}
}
-
+
else if ((pat_patctl.control & CTL_JITFAST) != 0)
{
start_time = clock();
@@ -4740,9 +4740,9 @@ for (gmatched = 0;; gmatched++)
dat_datctl.offset, dat_datctl.options | g_notempty, match_data,
dat_context, jit_stack);
}
- }
-
- else
+ }
+
+ else
{
start_time = clock();
for (i = 0; i < timeitm; i++)
@@ -4751,7 +4751,7 @@ for (gmatched = 0;; gmatched++)
dat_datctl.offset, dat_datctl.options | g_notempty, match_data,
dat_context);
}
- }
+ }
total_match_time += (time_taken = clock() - start_time);
fprintf(outfile, "Match time %.4f milliseconds\n",
(((double)time_taken * 1000.0) / (double)timeitm) /
@@ -4809,7 +4809,7 @@ for (gmatched = 0;; gmatched++)
if ((pat_patctl.control & CTL_JITFAST) != 0)
PCRE2_JIT_MATCH(capcount, compiled_code, pp, ulen, dat_datctl.offset,
dat_datctl.options | g_notempty, match_data, dat_context, jit_stack);
- else
+ else
PCRE2_MATCH(capcount, compiled_code, pp, ulen, dat_datctl.offset,
dat_datctl.options | g_notempty, match_data, dat_context);
if (capcount == 0)