Compiling with --disalbe-stack-for-recursion is working. Introduce PCRE2_OFFSET
for offset values.
This commit is contained in:
parent
b33a39fb15
commit
0188214a63
|
@ -175,7 +175,7 @@ sure both macros are undefined; an emulation function will then be used. */
|
||||||
recursion in the match() function; instead it creates its own stack by
|
recursion in the match() function; instead it creates its own stack by
|
||||||
steam using memory from the heap. For more detail, see the comments and
|
steam using memory from the heap. For more detail, see the comments and
|
||||||
other stuff just above the match() function. */
|
other stuff just above the match() function. */
|
||||||
/* #undef NO_RECURSE */
|
#define NO_RECURSE /**/
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#define PACKAGE "pcre2"
|
#define PACKAGE "pcre2"
|
||||||
|
|
62
src/pcre2.h
62
src/pcre2.h
|
@ -259,19 +259,19 @@ must all be greater than zero. */
|
||||||
/* A value that is used to indicate 'unset' in unsigned size_t fields. In
|
/* A value that is used to indicate 'unset' in unsigned size_t fields. In
|
||||||
particular, this value is used in the ovector. */
|
particular, this value is used in the ovector. */
|
||||||
|
|
||||||
#define PCRE2_UNSET (~(size_t)0)
|
#define PCRE2_UNSET (~(PCRE2_OFFSET)0)
|
||||||
|
|
||||||
/* Types for patterns and subject strings. */
|
/* Types for patterns, subject strings, and offsets. */
|
||||||
|
|
||||||
typedef uint8_t PCRE2_UCHAR8;
|
typedef uint8_t PCRE2_UCHAR8;
|
||||||
typedef uint16_t PCRE2_UCHAR16;
|
typedef uint16_t PCRE2_UCHAR16;
|
||||||
typedef uint32_t PCRE2_UCHAR32;
|
typedef uint32_t PCRE2_UCHAR32;
|
||||||
|
typedef uint32_t PCRE2_OFFSET;
|
||||||
|
|
||||||
typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
|
typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
|
||||||
typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
|
typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
|
||||||
typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
|
typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
|
||||||
|
|
||||||
|
|
||||||
/* Generic types for opaque structures and JIT callback functions. These
|
/* Generic types for opaque structures and JIT callback functions. These
|
||||||
declarations are defined in a macro that is expanded for each width later. */
|
declarations are defined in a macro that is expanded for each width later. */
|
||||||
|
|
||||||
|
@ -305,22 +305,22 @@ versions are generated from this macro below. */
|
||||||
|
|
||||||
#define PCRE2_STRUCTURE_LIST \
|
#define PCRE2_STRUCTURE_LIST \
|
||||||
typedef struct pcre2_callout_block { \
|
typedef struct pcre2_callout_block { \
|
||||||
int version; /* Identifies version of block */ \
|
int version; /* Identifies version of block */ \
|
||||||
/* ------------------------ Version 0 ------------------------------- */ \
|
/* ------------------------ Version 0 ------------------------------- */ \
|
||||||
uint32_t callout_number; /* Number compiled into pattern */ \
|
uint32_t callout_number; /* Number compiled into pattern */ \
|
||||||
size_t *offset_vector; /* The offset vector */ \
|
PCRE2_OFFSET *offset_vector; /* The offset vector */ \
|
||||||
PCRE2_SPTR subject; /* The subject being matched */ \
|
PCRE2_SPTR subject; /* The subject being matched */ \
|
||||||
size_t subject_length; /* The length of the subject */ \
|
size_t subject_length; /* The length of the subject */ \
|
||||||
size_t start_match; /* Offset to start of this match attempt */ \
|
PCRE2_OFFSET start_match; /* Offset to start of this match attempt */ \
|
||||||
size_t current_position; /* Where we currently are in the subject */ \
|
PCRE2_OFFSET current_position; /* Where we currently are in the subject */ \
|
||||||
uint32_t capture_top; /* Max current capture */ \
|
uint32_t capture_top; /* Max current capture */ \
|
||||||
uint32_t capture_last; /* Most recently closed capture */ \
|
uint32_t capture_last; /* Most recently closed capture */ \
|
||||||
void *callout_data; /* Data passed in with the call */ \
|
void *callout_data; /* Data passed in with the call */ \
|
||||||
/* ------------------- Added for Version 1 -------------------------- */ \
|
/* ------------------- Added for Version 1 -------------------------- */ \
|
||||||
size_t pattern_position; /* Offset to next item in the pattern */ \
|
PCRE2_OFFSET pattern_position; /* Offset to next item in the pattern */ \
|
||||||
size_t next_item_length; /* Length of next item in the pattern */ \
|
PCRE2_OFFSET next_item_length; /* Length of next item in the pattern */ \
|
||||||
/* ------------------- Added for Version 2 -------------------------- */ \
|
/* ------------------- Added for Version 2 -------------------------- */ \
|
||||||
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
|
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
|
||||||
/* ------------------------------------------------------------------ */ \
|
/* ------------------------------------------------------------------ */ \
|
||||||
} pcre2_callout_block;
|
} pcre2_callout_block;
|
||||||
|
|
||||||
|
@ -339,8 +339,7 @@ expanded for each width below. Start with functions that give general
|
||||||
information. */
|
information. */
|
||||||
|
|
||||||
#define PCRE2_GENERAL_INFO_FUNCTIONS \
|
#define PCRE2_GENERAL_INFO_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL int pcre2_config(int, void *, size_t); \
|
PCRE2_EXP_DECL int pcre2_config(int, void *, size_t);
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Functions for manipulating contexts. */
|
/* Functions for manipulating contexts. */
|
||||||
|
@ -389,7 +388,7 @@ PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_match_context *, \
|
||||||
uint32_t); \
|
uint32_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
|
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
|
||||||
pcre2_match_context *, void *(*)(size_t, void *), \
|
pcre2_match_context *, void *(*)(size_t, void *), \
|
||||||
void (*)(void *, void *));
|
void (*)(void *, void *), void *);
|
||||||
|
|
||||||
|
|
||||||
/* Functions concerned with compiling a pattern to PCRE internal code. */
|
/* Functions concerned with compiling a pattern to PCRE internal code. */
|
||||||
|
@ -397,7 +396,7 @@ PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
|
||||||
#define PCRE2_COMPILE_FUNCTIONS \
|
#define PCRE2_COMPILE_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
|
pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
|
||||||
int *, size_t *, pcre2_compile_context *); \
|
int *, PCRE2_OFFSET *, pcre2_compile_context *); \
|
||||||
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
|
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,26 +411,25 @@ PCRE2_EXP_DECL int pcre2_pattern_info(const pcre2_code *, uint32_t, \
|
||||||
|
|
||||||
#define PCRE2_MATCH_FUNCTIONS \
|
#define PCRE2_MATCH_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_match_data *pcre2_match_data_create(size_t, \
|
pcre2_match_data *pcre2_match_data_create(uint32_t, \
|
||||||
pcre2_general_context *); \
|
pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
|
pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
|
||||||
pcre2_general_context *); \
|
pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, int, size_t, uint32_t, \
|
PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_match_context *, int *, \
|
pcre2_match_data *, pcre2_match_context *, int *, \
|
||||||
size_t); \
|
size_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, int, size_t, uint32_t, \
|
PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_match_context *); \
|
pcre2_match_data *, pcre2_match_context *); \
|
||||||
PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
|
PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_leftchar(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
|
||||||
PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
|
PCRE2_EXP_DECL uint32_t pcre2_get_ovector_count(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_ovector_count(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET *pcre2_get_ovector_pointer(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t *pcre2_get_ovector_pointer(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_rightchar(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_startchar(pcre2_match_data *);
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *);
|
|
||||||
|
|
||||||
|
|
||||||
/* Convenience functions for handling matched substrings. */
|
/* Convenience functions for handling matched substrings. */
|
||||||
|
@ -464,7 +462,7 @@ PCRE2_EXP_DECL int pcre2_substring_list_get(pcre2_match_data *, \
|
||||||
#define PCRE2_JIT_FUNCTIONS \
|
#define PCRE2_JIT_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_code *, uint32_t); \
|
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_code *, uint32_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, int, size_t, uint32_t, \
|
PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_jit_stack *); \
|
pcre2_match_data *, pcre2_jit_stack *); \
|
||||||
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
|
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
|
@ -479,7 +477,6 @@ PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);
|
||||||
|
|
||||||
#define PCRE2_OTHER_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 *, size_t); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void); \
|
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
const unsigned char *pcre2_maketables(pcre2_general_context *); \
|
const unsigned char *pcre2_maketables(pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2_code *);
|
PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2_code *);
|
||||||
|
@ -539,7 +536,6 @@ pcre2_compile are called by application code. */
|
||||||
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
|
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
|
||||||
#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
|
#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
|
||||||
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
|
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
|
||||||
#define pcre2_get_match_frame_size PCRE2_SUFFIX(pcre2_get_match_frame_size_)
|
|
||||||
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
|
#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_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
|
||||||
#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
|
#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
|
||||||
|
|
|
@ -259,19 +259,19 @@ must all be greater than zero. */
|
||||||
/* A value that is used to indicate 'unset' in unsigned size_t fields. In
|
/* A value that is used to indicate 'unset' in unsigned size_t fields. In
|
||||||
particular, this value is used in the ovector. */
|
particular, this value is used in the ovector. */
|
||||||
|
|
||||||
#define PCRE2_UNSET (~(size_t)0)
|
#define PCRE2_UNSET (~(PCRE2_OFFSET)0)
|
||||||
|
|
||||||
/* Types for patterns and subject strings. */
|
/* Types for patterns, subject strings, and offsets. */
|
||||||
|
|
||||||
typedef uint8_t PCRE2_UCHAR8;
|
typedef uint8_t PCRE2_UCHAR8;
|
||||||
typedef uint16_t PCRE2_UCHAR16;
|
typedef uint16_t PCRE2_UCHAR16;
|
||||||
typedef uint32_t PCRE2_UCHAR32;
|
typedef uint32_t PCRE2_UCHAR32;
|
||||||
|
typedef uint32_t PCRE2_OFFSET;
|
||||||
|
|
||||||
typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
|
typedef const PCRE2_UCHAR8 *PCRE2_SPTR8;
|
||||||
typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
|
typedef const PCRE2_UCHAR16 *PCRE2_SPTR16;
|
||||||
typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
|
typedef const PCRE2_UCHAR32 *PCRE2_SPTR32;
|
||||||
|
|
||||||
|
|
||||||
/* Generic types for opaque structures and JIT callback functions. These
|
/* Generic types for opaque structures and JIT callback functions. These
|
||||||
declarations are defined in a macro that is expanded for each width later. */
|
declarations are defined in a macro that is expanded for each width later. */
|
||||||
|
|
||||||
|
@ -305,22 +305,22 @@ versions are generated from this macro below. */
|
||||||
|
|
||||||
#define PCRE2_STRUCTURE_LIST \
|
#define PCRE2_STRUCTURE_LIST \
|
||||||
typedef struct pcre2_callout_block { \
|
typedef struct pcre2_callout_block { \
|
||||||
int version; /* Identifies version of block */ \
|
int version; /* Identifies version of block */ \
|
||||||
/* ------------------------ Version 0 ------------------------------- */ \
|
/* ------------------------ Version 0 ------------------------------- */ \
|
||||||
uint32_t callout_number; /* Number compiled into pattern */ \
|
uint32_t callout_number; /* Number compiled into pattern */ \
|
||||||
size_t *offset_vector; /* The offset vector */ \
|
PCRE2_OFFSET *offset_vector; /* The offset vector */ \
|
||||||
PCRE2_SPTR subject; /* The subject being matched */ \
|
PCRE2_SPTR subject; /* The subject being matched */ \
|
||||||
size_t subject_length; /* The length of the subject */ \
|
size_t subject_length; /* The length of the subject */ \
|
||||||
size_t start_match; /* Offset to start of this match attempt */ \
|
PCRE2_OFFSET start_match; /* Offset to start of this match attempt */ \
|
||||||
size_t current_position; /* Where we currently are in the subject */ \
|
PCRE2_OFFSET current_position; /* Where we currently are in the subject */ \
|
||||||
uint32_t capture_top; /* Max current capture */ \
|
uint32_t capture_top; /* Max current capture */ \
|
||||||
uint32_t capture_last; /* Most recently closed capture */ \
|
uint32_t capture_last; /* Most recently closed capture */ \
|
||||||
void *callout_data; /* Data passed in with the call */ \
|
void *callout_data; /* Data passed in with the call */ \
|
||||||
/* ------------------- Added for Version 1 -------------------------- */ \
|
/* ------------------- Added for Version 1 -------------------------- */ \
|
||||||
size_t pattern_position; /* Offset to next item in the pattern */ \
|
PCRE2_OFFSET pattern_position; /* Offset to next item in the pattern */ \
|
||||||
size_t next_item_length; /* Length of next item in the pattern */ \
|
PCRE2_OFFSET next_item_length; /* Length of next item in the pattern */ \
|
||||||
/* ------------------- Added for Version 2 -------------------------- */ \
|
/* ------------------- Added for Version 2 -------------------------- */ \
|
||||||
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
|
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
|
||||||
/* ------------------------------------------------------------------ */ \
|
/* ------------------------------------------------------------------ */ \
|
||||||
} pcre2_callout_block;
|
} pcre2_callout_block;
|
||||||
|
|
||||||
|
@ -339,8 +339,7 @@ expanded for each width below. Start with functions that give general
|
||||||
information. */
|
information. */
|
||||||
|
|
||||||
#define PCRE2_GENERAL_INFO_FUNCTIONS \
|
#define PCRE2_GENERAL_INFO_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL int pcre2_config(int, void *, size_t); \
|
PCRE2_EXP_DECL int pcre2_config(int, void *, size_t);
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void);
|
|
||||||
|
|
||||||
|
|
||||||
/* Functions for manipulating contexts. */
|
/* Functions for manipulating contexts. */
|
||||||
|
@ -389,7 +388,7 @@ PCRE2_EXP_DECL int pcre2_set_recursion_limit(pcre2_match_context *, \
|
||||||
uint32_t); \
|
uint32_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
|
PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
|
||||||
pcre2_match_context *, void *(*)(size_t, void *), \
|
pcre2_match_context *, void *(*)(size_t, void *), \
|
||||||
void (*)(void *, void *));
|
void (*)(void *, void *), void *);
|
||||||
|
|
||||||
|
|
||||||
/* Functions concerned with compiling a pattern to PCRE internal code. */
|
/* Functions concerned with compiling a pattern to PCRE internal code. */
|
||||||
|
@ -397,7 +396,7 @@ PCRE2_EXP_DECL int pcre2_set_recursion_memory_management( \
|
||||||
#define PCRE2_COMPILE_FUNCTIONS \
|
#define PCRE2_COMPILE_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
|
pcre2_code *pcre2_compile(PCRE2_SPTR, int, uint32_t, \
|
||||||
int *, size_t *, pcre2_compile_context *); \
|
int *, PCRE2_OFFSET *, pcre2_compile_context *); \
|
||||||
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
|
PCRE2_EXP_DECL void pcre2_code_free(pcre2_code *);
|
||||||
|
|
||||||
|
|
||||||
|
@ -412,26 +411,25 @@ PCRE2_EXP_DECL int pcre2_pattern_info(const pcre2_code *, uint32_t, \
|
||||||
|
|
||||||
#define PCRE2_MATCH_FUNCTIONS \
|
#define PCRE2_MATCH_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_match_data *pcre2_match_data_create(size_t, \
|
pcre2_match_data *pcre2_match_data_create(uint32_t, \
|
||||||
pcre2_general_context *); \
|
pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
|
pcre2_match_data *pcre2_match_data_create_from_pattern(pcre2_code *, \
|
||||||
pcre2_general_context *); \
|
pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_dfa_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, int, size_t, uint32_t, \
|
PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_match_context *, int *, \
|
pcre2_match_data *, pcre2_match_context *, int *, \
|
||||||
size_t); \
|
size_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, int, size_t, uint32_t, \
|
PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_match_context *); \
|
pcre2_match_data *, pcre2_match_context *); \
|
||||||
PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
|
PCRE2_EXP_DECL void pcre2_match_data_free(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_leftchar(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_leftchar(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
|
||||||
PCRE2_SPTR pcre2_get_mark(pcre2_match_data *); \
|
PCRE2_EXP_DECL uint32_t pcre2_get_ovector_count(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_ovector_count(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET *pcre2_get_ovector_pointer(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t *pcre2_get_ovector_pointer(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_rightchar(pcre2_match_data *); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_rightchar(pcre2_match_data *); \
|
PCRE2_EXP_DECL PCRE2_OFFSET pcre2_get_startchar(pcre2_match_data *);
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_startchar(pcre2_match_data *);
|
|
||||||
|
|
||||||
|
|
||||||
/* Convenience functions for handling matched substrings. */
|
/* Convenience functions for handling matched substrings. */
|
||||||
|
@ -464,7 +462,7 @@ PCRE2_EXP_DECL int pcre2_substring_list_get(pcre2_match_data *, \
|
||||||
#define PCRE2_JIT_FUNCTIONS \
|
#define PCRE2_JIT_FUNCTIONS \
|
||||||
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_code *, uint32_t); \
|
PCRE2_EXP_DECL void pcre2_jit_compile(pcre2_code *, uint32_t); \
|
||||||
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
|
PCRE2_EXP_DECL int pcre2_jit_match(const pcre2_code *, \
|
||||||
PCRE2_SPTR, int, size_t, uint32_t, \
|
PCRE2_SPTR, int, PCRE2_OFFSET, uint32_t, \
|
||||||
pcre2_match_data *, pcre2_jit_stack *); \
|
pcre2_match_data *, pcre2_jit_stack *); \
|
||||||
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
|
PCRE2_EXP_DECL void pcre2_jit_free_unused_memory(pcre2_general_context *);\
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
|
@ -479,7 +477,6 @@ PCRE2_EXP_DECL void pcre2_jit_stack_free(pcre2_jit_stack *);
|
||||||
|
|
||||||
#define PCRE2_OTHER_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 *, size_t); \
|
||||||
PCRE2_EXP_DECL size_t pcre2_get_match_frame_size(void); \
|
|
||||||
PCRE2_EXP_DECL \
|
PCRE2_EXP_DECL \
|
||||||
const unsigned char *pcre2_maketables(pcre2_general_context *); \
|
const unsigned char *pcre2_maketables(pcre2_general_context *); \
|
||||||
PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2_code *);
|
PCRE2_EXP_DECL int pcre2_pattern_to_host_byte_order(pcre2_code *);
|
||||||
|
@ -539,7 +536,6 @@ pcre2_compile are called by application code. */
|
||||||
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
|
#define pcre2_get_error_message PCRE2_SUFFIX(pcre2_get_error_message_)
|
||||||
#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
|
#define pcre2_get_leftchar PCRE2_SUFFIX(pcre2_get_leftchar_)
|
||||||
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
|
#define pcre2_get_mark PCRE2_SUFFIX(pcre2_get_mark_)
|
||||||
#define pcre2_get_match_frame_size PCRE2_SUFFIX(pcre2_get_match_frame_size_)
|
|
||||||
#define pcre2_get_ovector_pointer PCRE2_SUFFIX(pcre2_get_ovector_pointer_)
|
#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_ovector_count PCRE2_SUFFIX(pcre2_get_ovector_count_)
|
||||||
#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
|
#define pcre2_get_rightchar PCRE2_SUFFIX(pcre2_get_rightchar_)
|
||||||
|
|
|
@ -7257,7 +7257,7 @@ Returns: pointer to compiled data block, or NULL on error,
|
||||||
|
|
||||||
PCRE2_EXP_DEFN pcre2_code * PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN pcre2_code * PCRE2_CALL_CONVENTION
|
||||||
pcre2_compile(PCRE2_SPTR pattern, int patlen, uint32_t options,
|
pcre2_compile(PCRE2_SPTR pattern, int patlen, uint32_t options,
|
||||||
int *errorptr, size_t *erroroffset, pcre2_compile_context *ccontext)
|
int *errorptr, PCRE2_OFFSET *erroroffset, pcre2_compile_context *ccontext)
|
||||||
{
|
{
|
||||||
BOOL utf; /* Set TRUE for UTF mode */
|
BOOL utf; /* Set TRUE for UTF mode */
|
||||||
pcre2_real_code *re = NULL; /* What we will return */
|
pcre2_real_code *re = NULL; /* What we will return */
|
||||||
|
|
|
@ -168,8 +168,7 @@ if (defmemctl)
|
||||||
mcontext->memctl.memory_data = NULL;
|
mcontext->memctl.memory_data = NULL;
|
||||||
}
|
}
|
||||||
#ifdef NO_RECURSE
|
#ifdef NO_RECURSE
|
||||||
mcontext->stack_malloc = mcontext->malloc;
|
mcontext->stack_memctl = mcontext->memctl;
|
||||||
mcontext->stack_free = mcontext->free;
|
|
||||||
#endif
|
#endif
|
||||||
mcontext->callout = NULL;
|
mcontext->callout = NULL;
|
||||||
mcontext->callout_data = NULL;
|
mcontext->callout_data = NULL;
|
||||||
|
@ -392,16 +391,18 @@ return 1;
|
||||||
|
|
||||||
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
||||||
pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
|
pcre2_set_recursion_memory_management(pcre2_match_context *mcontext,
|
||||||
void *(*mymalloc)(size_t, void *),
|
void *(*mymalloc)(size_t, void *), void (*myfree)(void *, void *),
|
||||||
void (*myfree)(void *, void *))
|
void *mydata)
|
||||||
{
|
{
|
||||||
#ifdef NORECURSE
|
#ifdef NO_RECURSE
|
||||||
mcontext->stack_malloc = mymalloc;
|
mcontext->stack_memctl.malloc = mymalloc;
|
||||||
mcontext->stack_free = myfree;
|
mcontext->stack_memctl.free = myfree;
|
||||||
|
mcontext->stack_memctl.memory_data = mydata;
|
||||||
#else
|
#else
|
||||||
(void)mcontext;
|
(void)mcontext;
|
||||||
(void)mymalloc;
|
(void)mymalloc;
|
||||||
(void)myfree;
|
(void)myfree;
|
||||||
|
(void)mydata;
|
||||||
#endif
|
#endif
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,7 +74,7 @@ Returns: > 0 => number of match offset pairs placed in offsets
|
||||||
|
|
||||||
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
||||||
pcre2_dfa_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
|
pcre2_dfa_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
|
||||||
size_t startoffset, uint32_t options, pcre2_match_data *match_data,
|
PCRE2_OFFSET startoffset, uint32_t options, pcre2_match_data *match_data,
|
||||||
pcre2_match_context *mcontext, int *workspace, size_t wscount)
|
pcre2_match_context *mcontext, int *workspace, size_t wscount)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -1859,7 +1859,7 @@ extern int _pcre2_strlen(PCRE2_SPTR);
|
||||||
extern int _pcre2_strncmp(PCRE2_SPTR, PCRE2_SPTR, size_t);
|
extern int _pcre2_strncmp(PCRE2_SPTR, PCRE2_SPTR, size_t);
|
||||||
extern int _pcre2_strncmp_c8(PCRE2_SPTR, const char *, size_t);
|
extern int _pcre2_strncmp_c8(PCRE2_SPTR, const char *, size_t);
|
||||||
extern int _pcre2_study(pcre2_real_code *);
|
extern int _pcre2_study(pcre2_real_code *);
|
||||||
extern int _pcre2_valid_utf(PCRE2_SPTR, int, size_t *);
|
extern int _pcre2_valid_utf(PCRE2_SPTR, int, PCRE2_OFFSET *);
|
||||||
extern BOOL _pcre2_was_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR, uint32_t *,
|
extern BOOL _pcre2_was_newline(PCRE2_SPTR, uint32_t, PCRE2_SPTR, uint32_t *,
|
||||||
BOOL);
|
BOOL);
|
||||||
extern BOOL _pcre2_xclass(uint32_t, PCRE2_SPTR, BOOL);
|
extern BOOL _pcre2_xclass(uint32_t, PCRE2_SPTR, BOOL);
|
||||||
|
|
|
@ -559,10 +559,9 @@ typedef struct pcre2_real_compile_context {
|
||||||
/* The real match context structure. */
|
/* The real match context structure. */
|
||||||
|
|
||||||
typedef struct pcre2_real_match_context {
|
typedef struct pcre2_real_match_context {
|
||||||
pcre2_memctl memctl;
|
pcre2_memctl memctl;
|
||||||
#ifdef NO_RECURSE
|
#ifdef NO_RECURSE
|
||||||
void * (*stack_malloc)(size_t, void *);
|
pcre2_memctl stack_memctl;
|
||||||
void (*stack_free)(void *, void *);
|
|
||||||
#endif
|
#endif
|
||||||
int (*callout)(pcre2_callout_block *);
|
int (*callout)(pcre2_callout_block *);
|
||||||
void *callout_data;
|
void *callout_data;
|
||||||
|
@ -605,12 +604,12 @@ typedef struct pcre2_real_match_data {
|
||||||
const pcre2_real_code *code; /* The pattern used for the match */
|
const pcre2_real_code *code; /* The pattern used for the match */
|
||||||
PCRE2_SPTR subject; /* The subject that was matched */
|
PCRE2_SPTR subject; /* The subject that was matched */
|
||||||
int rc; /* The return code from the match */
|
int rc; /* The return code from the match */
|
||||||
size_t leftchar; /* Offset to leftmost code unit */
|
PCRE2_OFFSET leftchar; /* Offset to leftmost code unit */
|
||||||
size_t rightchar; /* Offset to rightmost code unit */
|
PCRE2_OFFSET rightchar; /* Offset to rightmost code unit */
|
||||||
size_t startchar; /* Offset to starting code unit */
|
PCRE2_OFFSET startchar; /* Offset to starting code unit */
|
||||||
PCRE2_SPTR mark; /* Pointer to last mark */
|
PCRE2_SPTR mark; /* Pointer to last mark */
|
||||||
uint16_t oveccount; /* Number of pairs */
|
uint16_t oveccount; /* Number of pairs */
|
||||||
size_t ovector[1]; /* The first field */
|
PCRE2_OFFSET ovector[1]; /* The first field */
|
||||||
} pcre2_real_match_data;
|
} pcre2_real_match_data;
|
||||||
|
|
||||||
|
|
||||||
|
@ -684,7 +683,7 @@ call within the pattern; used by pcre_match(). */
|
||||||
typedef struct recursion_info {
|
typedef struct recursion_info {
|
||||||
struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
|
struct recursion_info *prevrec; /* Previous recursion record (or NULL) */
|
||||||
unsigned int group_num; /* Number of group that was called */
|
unsigned int group_num; /* Number of group that was called */
|
||||||
size_t *offset_save; /* Pointer to start of saved offsets */
|
PCRE2_OFFSET *offset_save; /* Pointer to start of saved offsets */
|
||||||
uint32_t saved_max; /* Number of saved offsets */
|
uint32_t saved_max; /* Number of saved offsets */
|
||||||
uint32_t saved_capture_last; /* Last capture number */
|
uint32_t saved_capture_last; /* Last capture number */
|
||||||
PCRE2_SPTR subject_position; /* Position at start of recursion */
|
PCRE2_SPTR subject_position; /* Position at start of recursion */
|
||||||
|
@ -694,8 +693,8 @@ typedef struct recursion_info {
|
||||||
|
|
||||||
typedef struct dfa_recursion_info {
|
typedef struct dfa_recursion_info {
|
||||||
struct dfa_recursion_info *prevrec;
|
struct dfa_recursion_info *prevrec;
|
||||||
uint32_t group_num;
|
|
||||||
PCRE2_SPTR subject_position;
|
PCRE2_SPTR subject_position;
|
||||||
|
uint32_t group_num;
|
||||||
} dfa_recursion_info;
|
} dfa_recursion_info;
|
||||||
|
|
||||||
/* Structure for building a chain of data for holding the values of the subject
|
/* Structure for building a chain of data for holding the values of the subject
|
||||||
|
@ -712,20 +711,23 @@ typedef struct eptrblock {
|
||||||
doing traditional NFA matching (pcre2_match() and friends). */
|
doing traditional NFA matching (pcre2_match() and friends). */
|
||||||
|
|
||||||
typedef struct match_block {
|
typedef struct match_block {
|
||||||
pcre2_memctl memctl;
|
pcre2_memctl memctl; /* For general use */
|
||||||
unsigned long int match_call_count; /* As it says */
|
#ifdef NO_RECURSE
|
||||||
unsigned long int match_limit; /* As it says */
|
pcre2_memctl stack_memctl; /* For "stack" frames */
|
||||||
unsigned long int match_limit_recursion; /* As it says */
|
#endif
|
||||||
|
uint32_t match_call_count; /* As it says */
|
||||||
|
uint32_t match_limit; /* As it says */
|
||||||
|
uint32_t match_limit_recursion; /* As it says */
|
||||||
BOOL hitend; /* Hit the end of the subject at some point */
|
BOOL hitend; /* Hit the end of the subject at some point */
|
||||||
BOOL hasthen; /* Pattern contains (*THEN) */
|
BOOL hasthen; /* Pattern contains (*THEN) */
|
||||||
const uint8_t *lcc; /* Points to lower casing table */
|
const uint8_t *lcc; /* Points to lower casing table */
|
||||||
const uint8_t *fcc; /* Points to case-flipping table */
|
const uint8_t *fcc; /* Points to case-flipping table */
|
||||||
const uint8_t *ctypes; /* Points to table of type maps */
|
const uint8_t *ctypes; /* Points to table of type maps */
|
||||||
size_t *ovector; /* Pointer to the offset vector */
|
PCRE2_OFFSET *ovector; /* Pointer to the offset vector */
|
||||||
size_t offset_end; /* One past the end */
|
PCRE2_OFFSET offset_end; /* One past the end */
|
||||||
size_t offset_max; /* The maximum usable for return data */
|
PCRE2_OFFSET offset_max; /* The maximum usable for return data */
|
||||||
size_t start_offset; /* The start offset value */
|
PCRE2_OFFSET start_offset; /* The start offset value */
|
||||||
size_t end_offset_top; /* Highwater mark at end of match */
|
PCRE2_OFFSET end_offset_top; /* Highwater mark at end of match */
|
||||||
uint16_t partial; /* PARTIAL options */
|
uint16_t partial; /* PARTIAL options */
|
||||||
uint16_t bsr_convention; /* \R interpretation */
|
uint16_t bsr_convention; /* \R interpretation */
|
||||||
uint16_t name_count; /* Number of names in name table */
|
uint16_t name_count; /* Number of names in name table */
|
||||||
|
@ -768,8 +770,8 @@ typedef struct dfa_match_block {
|
||||||
PCRE2_SPTR start_used_ptr; /* Earliest consulted character */
|
PCRE2_SPTR start_used_ptr; /* Earliest consulted character */
|
||||||
const uint8_t *tables; /* Character tables */
|
const uint8_t *tables; /* Character tables */
|
||||||
int start_offset; /* The start offset value */
|
int start_offset; /* The start offset value */
|
||||||
uint32_t moptions; /* Match options */
|
uint32_t moptions; /* Match options */
|
||||||
uint32_t poptions; /* Pattern options */
|
uint32_t poptions; /* Pattern options */
|
||||||
int nltype; /* Newline type */
|
int nltype; /* Newline type */
|
||||||
int nllen; /* Newline string length */
|
int nllen; /* Newline string length */
|
||||||
PCRE2_UCHAR nl[4]; /* Newline string when fixed */
|
PCRE2_UCHAR nl[4]; /* Newline string when fixed */
|
||||||
|
|
|
@ -71,7 +71,7 @@ Returns: > 0 => success; value is the number of ovector pairs filled
|
||||||
|
|
||||||
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
||||||
pcre2_jit_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
|
pcre2_jit_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
|
||||||
size_t start_offset, uint32_t options, pcre2_match_data *match_data,
|
PCRE2_OFFSET start_offset, uint32_t options, pcre2_match_data *match_data,
|
||||||
pcre2_jit_stack *jit_stack)
|
pcre2_jit_stack *jit_stack)
|
||||||
{
|
{
|
||||||
#ifndef SUPPORT_JIT
|
#ifndef SUPPORT_JIT
|
||||||
|
|
|
@ -292,7 +292,8 @@ argument of match(), which never changes. */
|
||||||
heapframe *newframe = frame->Xnextframe;\
|
heapframe *newframe = frame->Xnextframe;\
|
||||||
if (newframe == NULL)\
|
if (newframe == NULL)\
|
||||||
{\
|
{\
|
||||||
newframe = (heapframe *)(PUBL(stack_malloc))(sizeof(heapframe));\
|
newframe = (heapframe *)(mb->stack_memctl.malloc)\
|
||||||
|
(sizeof(heapframe), mb->stack_memctl.memory_data);\
|
||||||
if (newframe == NULL) RRETURN(PCRE2_ERROR_NOMEMORY);\
|
if (newframe == NULL) RRETURN(PCRE2_ERROR_NOMEMORY);\
|
||||||
newframe->Xnextframe = NULL;\
|
newframe->Xnextframe = NULL;\
|
||||||
frame->Xnextframe = newframe;\
|
frame->Xnextframe = newframe;\
|
||||||
|
@ -307,7 +308,7 @@ argument of match(), which never changes. */
|
||||||
newframe->Xprevframe = frame;\
|
newframe->Xprevframe = frame;\
|
||||||
frame = newframe;\
|
frame = newframe;\
|
||||||
goto HEAP_RECURSE;\
|
goto HEAP_RECURSE;\
|
||||||
L_##rw:\
|
L_##rw:;\
|
||||||
}
|
}
|
||||||
|
|
||||||
#define RRETURN(ra)\
|
#define RRETURN(ra)\
|
||||||
|
@ -323,67 +324,64 @@ argument of match(), which never changes. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Structure for remembering the local variables in a private frame */
|
/* Structure for remembering the local variables in a private frame. Arrange it
|
||||||
|
so as to minimize the number of holes. */
|
||||||
|
|
||||||
typedef struct heapframe {
|
typedef struct heapframe {
|
||||||
struct heapframe *Xprevframe;
|
struct heapframe *Xprevframe;
|
||||||
struct heapframe *Xnextframe;
|
struct heapframe *Xnextframe;
|
||||||
|
|
||||||
/* Function arguments that may change */
|
|
||||||
|
|
||||||
PCRE2_SPTR Xeptr;
|
|
||||||
PCRE2_SPTR Xecode;
|
|
||||||
PCRE2_SPTR Xmstart;
|
|
||||||
int Xoffset_top;
|
|
||||||
eptrblock *Xeptrb;
|
|
||||||
unsigned int Xrdepth;
|
|
||||||
|
|
||||||
/* Function local variables */
|
|
||||||
|
|
||||||
PCRE2_SPTR Xcallpat;
|
|
||||||
#ifdef SUPPORT_UTF
|
#ifdef SUPPORT_UTF
|
||||||
PCRE2_SPTR Xcharptr;
|
PCRE2_SPTR Xcharptr;
|
||||||
#endif
|
#endif
|
||||||
|
PCRE2_SPTR Xeptr;
|
||||||
|
PCRE2_SPTR Xecode;
|
||||||
|
PCRE2_SPTR Xmstart;
|
||||||
|
PCRE2_SPTR Xcallpat;
|
||||||
PCRE2_SPTR Xdata;
|
PCRE2_SPTR Xdata;
|
||||||
PCRE2_SPTR Xnext;
|
PCRE2_SPTR Xnext;
|
||||||
PCRE2_SPTR Xpp;
|
PCRE2_SPTR Xpp;
|
||||||
PCRE2_SPTR Xprev;
|
PCRE2_SPTR Xprev;
|
||||||
PCRE2_SPTR Xsaved_eptr;
|
PCRE2_SPTR Xsaved_eptr;
|
||||||
|
|
||||||
recursion_info Xnew_recursive;
|
eptrblock *Xeptrb;
|
||||||
|
|
||||||
BOOL Xcur_is_word;
|
PCRE2_OFFSET Xoffset;
|
||||||
BOOL Xcondition;
|
PCRE2_OFFSET Xoffset_top;
|
||||||
BOOL Xprev_is_word;
|
PCRE2_OFFSET Xstacksave[REC_STACK_SAVE_MAX];
|
||||||
|
PCRE2_OFFSET Xsave_offset1, Xsave_offset2, Xsave_offset3;
|
||||||
|
|
||||||
|
uint32_t Xfc;
|
||||||
|
uint32_t Xnumber;
|
||||||
|
uint32_t Xrdepth;
|
||||||
|
uint32_t Xop;
|
||||||
|
uint32_t Xsave_capture_last;
|
||||||
|
|
||||||
#ifdef SUPPORT_UTF
|
#ifdef SUPPORT_UTF
|
||||||
|
uint32_t Xprop_value;
|
||||||
int Xprop_type;
|
int Xprop_type;
|
||||||
unsigned int Xprop_value;
|
|
||||||
int Xprop_fail_result;
|
int Xprop_fail_result;
|
||||||
int Xoclength;
|
int Xoclength;
|
||||||
PCRE2_UCHAR Xocchars[6];
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int Xcodelink;
|
int Xcodelink;
|
||||||
int Xctype;
|
int Xctype;
|
||||||
unsigned int Xfc;
|
|
||||||
int Xfi;
|
int Xfi;
|
||||||
int Xlength;
|
int Xlength;
|
||||||
int Xmax;
|
int Xmax;
|
||||||
int Xmin;
|
int Xmin;
|
||||||
unsigned int Xnumber;
|
int Xwhere; /* Where to jump back to */
|
||||||
int Xoffset;
|
|
||||||
unsigned int Xop;
|
BOOL Xcondition;
|
||||||
uint32_t Xsave_capture_last;
|
BOOL Xcur_is_word;
|
||||||
int Xsave_offset1, Xsave_offset2, Xsave_offset3;
|
BOOL Xprev_is_word;
|
||||||
size_t Xstacksave[REC_STACK_SAVE_MAX];
|
|
||||||
|
|
||||||
eptrblock Xnewptrb;
|
eptrblock Xnewptrb;
|
||||||
|
recursion_info Xnew_recursive;
|
||||||
|
|
||||||
/* Where to jump back to */
|
#ifdef SUPPORT_UTF
|
||||||
|
PCRE2_UCHAR Xocchars[6];
|
||||||
int Xwhere;
|
#endif
|
||||||
|
|
||||||
} heapframe;
|
} heapframe;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -450,8 +448,8 @@ Returns: MATCH_MATCH if matched ) these values are >= 0
|
||||||
|
|
||||||
static int
|
static int
|
||||||
match(REGISTER PCRE2_SPTR eptr, REGISTER PCRE2_SPTR ecode,
|
match(REGISTER PCRE2_SPTR eptr, REGISTER PCRE2_SPTR ecode,
|
||||||
PCRE2_SPTR mstart, size_t offset_top, match_block *mb, eptrblock *eptrb,
|
PCRE2_SPTR mstart, PCRE2_OFFSET offset_top, match_block *mb, eptrblock *eptrb,
|
||||||
unsigned int rdepth)
|
uint32_t rdepth)
|
||||||
{
|
{
|
||||||
/* These variables do not need to be preserved over recursion in this function,
|
/* These variables do not need to be preserved over recursion in this function,
|
||||||
so they can be ordinary variables in all cases. Mark some of them with
|
so they can be ordinary variables in all cases. Mark some of them with
|
||||||
|
@ -459,7 +457,7 @@ so they can be ordinary variables in all cases. Mark some of them with
|
||||||
|
|
||||||
register int rrc; /* Returns from recursive calls */
|
register int rrc; /* Returns from recursive calls */
|
||||||
register int i; /* Used for loops not involving calls to RMATCH() */
|
register int i; /* Used for loops not involving calls to RMATCH() */
|
||||||
register uint32_t c; /* Character values not kept over RMATCH() calls */
|
register uint32_t c; /* Character values not kept over RMATCH() calls */
|
||||||
register BOOL utf; /* Local copy of UTF flag for speed */
|
register BOOL utf; /* Local copy of UTF flag for speed */
|
||||||
|
|
||||||
BOOL minimize, possessive; /* Quantifier options */
|
BOOL minimize, possessive; /* Quantifier options */
|
||||||
|
@ -502,7 +500,14 @@ HEAP_RECURSE:
|
||||||
|
|
||||||
#ifdef SUPPORT_UTF
|
#ifdef SUPPORT_UTF
|
||||||
#define charptr frame->Xcharptr
|
#define charptr frame->Xcharptr
|
||||||
|
#define prop_value frame->Xprop_value
|
||||||
|
#define prop_type frame->Xprop_type
|
||||||
|
#define prop_fail_result frame->Xprop_fail_result
|
||||||
|
#define oclength frame->Xoclength
|
||||||
|
#define occhars frame->Xocchars
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define callpat frame->Xcallpat
|
#define callpat frame->Xcallpat
|
||||||
#define codelink frame->Xcodelink
|
#define codelink frame->Xcodelink
|
||||||
#define data frame->Xdata
|
#define data frame->Xdata
|
||||||
|
@ -513,18 +518,6 @@ HEAP_RECURSE:
|
||||||
|
|
||||||
#define new_recursive frame->Xnew_recursive
|
#define new_recursive frame->Xnew_recursive
|
||||||
|
|
||||||
#define cur_is_word frame->Xcur_is_word
|
|
||||||
#define condition frame->Xcondition
|
|
||||||
#define prev_is_word frame->Xprev_is_word
|
|
||||||
|
|
||||||
#ifdef SUPPORT_UTF
|
|
||||||
#define prop_type frame->Xprop_type
|
|
||||||
#define prop_value frame->Xprop_value
|
|
||||||
#define prop_fail_result frame->Xprop_fail_result
|
|
||||||
#define oclength frame->Xoclength
|
|
||||||
#define occhars frame->Xocchars
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define ctype frame->Xctype
|
#define ctype frame->Xctype
|
||||||
#define fc frame->Xfc
|
#define fc frame->Xfc
|
||||||
#define fi frame->Xfi
|
#define fi frame->Xfi
|
||||||
|
@ -540,6 +533,10 @@ HEAP_RECURSE:
|
||||||
#define save_offset3 frame->Xsave_offset3
|
#define save_offset3 frame->Xsave_offset3
|
||||||
#define stacksave frame->Xstacksave
|
#define stacksave frame->Xstacksave
|
||||||
|
|
||||||
|
#define condition frame->Xcondition
|
||||||
|
#define cur_is_word frame->Xcur_is_word
|
||||||
|
#define prev_is_word frame->Xprev_is_word
|
||||||
|
|
||||||
#define newptrb frame->Xnewptrb
|
#define newptrb frame->Xnewptrb
|
||||||
|
|
||||||
/* When recursion is being used, local variables are allocated on the stack and
|
/* When recursion is being used, local variables are allocated on the stack and
|
||||||
|
@ -564,19 +561,21 @@ PCRE2_SPTR charptr;
|
||||||
PCRE2_SPTR callpat;
|
PCRE2_SPTR callpat;
|
||||||
PCRE2_SPTR data;
|
PCRE2_SPTR data;
|
||||||
PCRE2_SPTR next;
|
PCRE2_SPTR next;
|
||||||
PCRE2_SPTR pp;
|
PCRE2_SPTR pp;
|
||||||
PCRE2_SPTR prev;
|
PCRE2_SPTR prev;
|
||||||
PCRE2_SPTR saved_eptr;
|
PCRE2_SPTR saved_eptr;
|
||||||
|
|
||||||
recursion_info new_recursive;
|
PCRE2_OFFSET offset;
|
||||||
|
PCRE2_OFFSET stacksave[REC_STACK_SAVE_MAX];
|
||||||
|
PCRE2_OFFSET save_offset1, save_offset2, save_offset3;
|
||||||
|
|
||||||
BOOL cur_is_word;
|
uint32_t number;
|
||||||
BOOL condition;
|
uint32_t op;
|
||||||
BOOL prev_is_word;
|
uint32_t save_capture_last;
|
||||||
|
|
||||||
#ifdef SUPPORT_UTF
|
#ifdef SUPPORT_UTF
|
||||||
|
uint32_t prop_value;
|
||||||
int prop_type;
|
int prop_type;
|
||||||
unsigned int prop_value;
|
|
||||||
int prop_fail_result;
|
int prop_fail_result;
|
||||||
int oclength;
|
int oclength;
|
||||||
PCRE2_UCHAR occhars[6];
|
PCRE2_UCHAR occhars[6];
|
||||||
|
@ -587,32 +586,14 @@ int ctype;
|
||||||
int length;
|
int length;
|
||||||
int max;
|
int max;
|
||||||
int min;
|
int min;
|
||||||
unsigned int number;
|
|
||||||
size_t offset;
|
BOOL condition;
|
||||||
unsigned int op;
|
BOOL cur_is_word;
|
||||||
uint32_t save_capture_last;
|
BOOL prev_is_word;
|
||||||
int save_offset1, save_offset2, save_offset3;
|
|
||||||
size_t stacksave[REC_STACK_SAVE_MAX];
|
|
||||||
|
|
||||||
eptrblock newptrb;
|
eptrblock newptrb;
|
||||||
|
recursion_info new_recursive;
|
||||||
/* There is a special fudge for calling match() in a way that causes it to
|
#endif /* NO_RECURSE not defined */
|
||||||
measure the size of its basic stack frame when the stack is being used for
|
|
||||||
recursion. The second argument (ecode) being NULL triggers this behaviour. It
|
|
||||||
cannot normally ever be NULL. The return is the negated value of the frame
|
|
||||||
size. */
|
|
||||||
|
|
||||||
if (ecode == NULL)
|
|
||||||
{
|
|
||||||
if (rdepth == 0)
|
|
||||||
return match((PCRE2_SPTR)&rdepth, NULL, NULL, 0, NULL, NULL, 1);
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int len = (char *)&rdepth - (char *)eptr;
|
|
||||||
return (len > 0)? -len : len;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* NO_RECURSE */
|
|
||||||
|
|
||||||
/* To save space on the stack and in the heap frame, I have doubled up on some
|
/* To save space on the stack and in the heap frame, I have doubled up on some
|
||||||
of the local variables that are used only in localised parts of the code, but
|
of the local variables that are used only in localised parts of the code, but
|
||||||
|
@ -1248,7 +1229,7 @@ for (;;)
|
||||||
case OP_RREF: /* Numbered group recursion test */
|
case OP_RREF: /* Numbered group recursion test */
|
||||||
if (mb->recursive != NULL) /* Not recursing => FALSE */
|
if (mb->recursive != NULL) /* Not recursing => FALSE */
|
||||||
{
|
{
|
||||||
unsigned int recno = GET2(ecode, 1); /* Recursion group number*/
|
uint32_t recno = GET2(ecode, 1); /* Recursion group number*/
|
||||||
condition = (recno == RREF_ANY || recno == mb->recursive->group_num);
|
condition = (recno == RREF_ANY || recno == mb->recursive->group_num);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1260,7 +1241,7 @@ for (;;)
|
||||||
PCRE2_SPTR slot = mb->name_table + GET2(ecode, 1) * mb->name_entry_size;
|
PCRE2_SPTR slot = mb->name_table + GET2(ecode, 1) * mb->name_entry_size;
|
||||||
while (count-- > 0)
|
while (count-- > 0)
|
||||||
{
|
{
|
||||||
unsigned int recno = GET2(slot, 0);
|
uint32_t recno = GET2(slot, 0);
|
||||||
condition = recno == mb->recursive->group_num;
|
condition = recno == mb->recursive->group_num;
|
||||||
if (condition) break;
|
if (condition) break;
|
||||||
slot += mb->name_entry_size;
|
slot += mb->name_entry_size;
|
||||||
|
@ -1638,7 +1619,7 @@ for (;;)
|
||||||
case OP_RECURSE:
|
case OP_RECURSE:
|
||||||
{
|
{
|
||||||
recursion_info *ri;
|
recursion_info *ri;
|
||||||
unsigned int recno;
|
uint32_t recno;
|
||||||
|
|
||||||
callpat = mb->start_code + GET(ecode, 1);
|
callpat = mb->start_code + GET(ecode, 1);
|
||||||
recno = (callpat == mb->start_code)? 0 :
|
recno = (callpat == mb->start_code)? 0 :
|
||||||
|
@ -1671,13 +1652,13 @@ for (;;)
|
||||||
new_recursive.offset_save = stacksave;
|
new_recursive.offset_save = stacksave;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
new_recursive.offset_save = (size_t *)
|
new_recursive.offset_save = (PCRE2_OFFSET *)
|
||||||
(mb->memctl.malloc(new_recursive.saved_max * sizeof(size_t),
|
(mb->memctl.malloc(new_recursive.saved_max * sizeof(PCRE2_OFFSET),
|
||||||
mb->memctl.memory_data));
|
mb->memctl.memory_data));
|
||||||
if (new_recursive.offset_save == NULL) RRETURN(PCRE2_ERROR_NOMEMORY);
|
if (new_recursive.offset_save == NULL) RRETURN(PCRE2_ERROR_NOMEMORY);
|
||||||
}
|
}
|
||||||
memcpy(new_recursive.offset_save, mb->ovector,
|
memcpy(new_recursive.offset_save, mb->ovector,
|
||||||
new_recursive.saved_max * sizeof(size_t));
|
new_recursive.saved_max * sizeof(PCRE2_OFFSET));
|
||||||
|
|
||||||
/* OK, now we can do the recursion. After processing each alternative,
|
/* OK, now we can do the recursion. After processing each alternative,
|
||||||
restore the offset data and the last captured value. If there were nested
|
restore the offset data and the last captured value. If there were nested
|
||||||
|
@ -1691,7 +1672,7 @@ for (;;)
|
||||||
RMATCH(eptr, callpat + PRIV(OP_lengths)[*callpat], offset_top,
|
RMATCH(eptr, callpat + PRIV(OP_lengths)[*callpat], offset_top,
|
||||||
mb, eptrb, RM6);
|
mb, eptrb, RM6);
|
||||||
memcpy(mb->ovector, new_recursive.offset_save,
|
memcpy(mb->ovector, new_recursive.offset_save,
|
||||||
new_recursive.saved_max * sizeof(size_t));
|
new_recursive.saved_max * sizeof(PCRE2_OFFSET));
|
||||||
mb->capture_last = new_recursive.saved_capture_last;
|
mb->capture_last = new_recursive.saved_capture_last;
|
||||||
mb->recursive = new_recursive.prevrec;
|
mb->recursive = new_recursive.prevrec;
|
||||||
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
|
if (rrc == MATCH_MATCH || rrc == MATCH_ACCEPT)
|
||||||
|
@ -1855,8 +1836,8 @@ for (;;)
|
||||||
|
|
||||||
if (offset > offset_top)
|
if (offset > offset_top)
|
||||||
{
|
{
|
||||||
register size_t *iptr = mb->ovector + offset_top;
|
register PCRE2_OFFSET *iptr = mb->ovector + offset_top;
|
||||||
register size_t *iend = mb->ovector + offset;
|
register PCRE2_OFFSET *iend = mb->ovector + offset;
|
||||||
while (iptr < iend) *iptr++ = PCRE2_UNSET;
|
while (iptr < iend) *iptr++ = PCRE2_UNSET;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3655,7 +3636,7 @@ for (;;)
|
||||||
RRETURN(MATCH_NOMATCH);
|
RRETURN(MATCH_NOMATCH);
|
||||||
}
|
}
|
||||||
GETCHARINC(d, eptr);
|
GETCHARINC(d, eptr);
|
||||||
if (fc == d || (unsigned int)foc == d) RRETURN(MATCH_NOMATCH);
|
if (fc == d || (uint32_t)foc == d) RRETURN(MATCH_NOMATCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3693,7 +3674,7 @@ for (;;)
|
||||||
RRETURN(MATCH_NOMATCH);
|
RRETURN(MATCH_NOMATCH);
|
||||||
}
|
}
|
||||||
GETCHARINC(d, eptr);
|
GETCHARINC(d, eptr);
|
||||||
if (fc == d || (unsigned int)foc == d) RRETURN(MATCH_NOMATCH);
|
if (fc == d || (uint32_t)foc == d) RRETURN(MATCH_NOMATCH);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3736,7 +3717,7 @@ for (;;)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
GETCHARLEN(d, eptr, len);
|
GETCHARLEN(d, eptr, len);
|
||||||
if (fc == d || (unsigned int)foc == d) break;
|
if (fc == d || (uint32_t)foc == d) break;
|
||||||
eptr += len;
|
eptr += len;
|
||||||
}
|
}
|
||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
|
@ -5584,7 +5565,7 @@ for (;;)
|
||||||
|
|
||||||
case OP_ANYBYTE:
|
case OP_ANYBYTE:
|
||||||
c = max - min;
|
c = max - min;
|
||||||
if (c > (unsigned int)(mb->end_subject - eptr))
|
if (c > (uint32_t)(mb->end_subject - eptr))
|
||||||
{
|
{
|
||||||
eptr = mb->end_subject;
|
eptr = mb->end_subject;
|
||||||
SCHECK_PARTIAL();
|
SCHECK_PARTIAL();
|
||||||
|
@ -5803,7 +5784,7 @@ for (;;)
|
||||||
case OP_ALLANY:
|
case OP_ALLANY:
|
||||||
case OP_ANYBYTE:
|
case OP_ANYBYTE:
|
||||||
c = max - min;
|
c = max - min;
|
||||||
if (c > (unsigned int)(mb->end_subject - eptr))
|
if (c > (uint32_t)(mb->end_subject - eptr))
|
||||||
{
|
{
|
||||||
eptr = mb->end_subject;
|
eptr = mb->end_subject;
|
||||||
SCHECK_PARTIAL();
|
SCHECK_PARTIAL();
|
||||||
|
@ -6109,8 +6090,7 @@ Undefine all the macros that were defined above to handle this. */
|
||||||
#undef stacksave
|
#undef stacksave
|
||||||
|
|
||||||
#undef newptrb
|
#undef newptrb
|
||||||
|
#endif /* NO_RECURSE */
|
||||||
#endif
|
|
||||||
|
|
||||||
/* These two are defined as macros in both cases */
|
/* These two are defined as macros in both cases */
|
||||||
|
|
||||||
|
@ -6129,46 +6109,28 @@ Undefine all the macros that were defined above to handle this. */
|
||||||
/* This function releases all the allocated frames. The base frame is on the
|
/* This function releases all the allocated frames. The base frame is on the
|
||||||
machine stack, and so must not be freed.
|
machine stack, and so must not be freed.
|
||||||
|
|
||||||
Argument: the address of the base frame
|
Argument:
|
||||||
|
frame_base the address of the base frame
|
||||||
|
mb the match block
|
||||||
|
|
||||||
Returns: nothing
|
Returns: nothing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static void
|
static void
|
||||||
release_match_heapframes (heapframe *frame_base)
|
release_match_heapframes (heapframe *frame_base, match_block *mb)
|
||||||
{
|
{
|
||||||
heapframe *nextframe = frame_base->Xnextframe;
|
heapframe *nextframe = frame_base->Xnextframe;
|
||||||
while (nextframe != NULL)
|
while (nextframe != NULL)
|
||||||
{
|
{
|
||||||
heapframe *oldframe = nextframe;
|
heapframe *oldframe = nextframe;
|
||||||
nextframe = nextframe->Xnextframe;
|
nextframe = nextframe->Xnextframe;
|
||||||
(PUBL(stack_free))(oldframe);
|
mb->stack_memctl.free(oldframe, mb->stack_memctl.memory_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* NO_RECURSE */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef FIXME
|
|
||||||
|
|
||||||
/* FIXME: This must be in a new function..... */
|
|
||||||
|
|
||||||
/* Check for the special magic call that measures the size of the stack used
|
|
||||||
per recursive call of match(). Without the funny casting for sizeof, a Windows
|
|
||||||
compiler gave this error: "unary minus operator applied to unsigned type,
|
|
||||||
result still unsigned". Hopefully the cast fixes that. */
|
|
||||||
|
|
||||||
if (re == NULL && extra_data == NULL && subject == NULL && length == -999 &&
|
|
||||||
start_offset == -999)
|
|
||||||
#ifdef NO_RECURSE
|
|
||||||
return -((int)sizeof(heapframe));
|
|
||||||
#else
|
|
||||||
return match(NULL, NULL, NULL, 0, NULL, NULL, 0);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif /* FIXME */
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
* Match a Regular Expression *
|
* Match a Regular Expression *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
@ -6195,7 +6157,7 @@ Returns: > 0 => success; value is the number of ovector pairs filled
|
||||||
|
|
||||||
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION
|
||||||
pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
|
pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, int length,
|
||||||
size_t start_offset, uint32_t options, pcre2_match_data *match_data,
|
PCRE2_OFFSET start_offset, uint32_t options, pcre2_match_data *match_data,
|
||||||
pcre2_match_context *mcontext)
|
pcre2_match_context *mcontext)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -6207,7 +6169,6 @@ const uint8_t *start_bits = NULL;
|
||||||
const pcre2_real_code *re = (const pcre2_real_code *)code;
|
const pcre2_real_code *re = (const pcre2_real_code *)code;
|
||||||
pcre2_match_context default_context; /* For use if no context given */
|
pcre2_match_context default_context; /* For use if no context given */
|
||||||
|
|
||||||
|
|
||||||
BOOL anchored;
|
BOOL anchored;
|
||||||
BOOL firstline;
|
BOOL firstline;
|
||||||
BOOL has_first_cu = FALSE;
|
BOOL has_first_cu = FALSE;
|
||||||
|
@ -6329,14 +6290,20 @@ startline = (re->flags & PCRE2_STARTLINE) != 0;
|
||||||
|
|
||||||
if (mcontext == NULL)
|
if (mcontext == NULL)
|
||||||
{
|
{
|
||||||
mb->memctl = re->memctl;
|
|
||||||
mb->callout = NULL;
|
mb->callout = NULL;
|
||||||
|
mb->memctl = re->memctl;
|
||||||
|
#ifdef NO_RECURSE
|
||||||
|
mb->stack_memctl = re->memctl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mb->memctl = mcontext->memctl;
|
|
||||||
mb->callout = mcontext->callout;
|
mb->callout = mcontext->callout;
|
||||||
mb->callout_data = mcontext->callout_data;
|
mb->callout_data = mcontext->callout_data;
|
||||||
|
mb->memctl = mcontext->memctl;
|
||||||
|
#ifdef NO_RECURSE
|
||||||
|
mb->stack_memctl = mcontext->stack_memctl;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mb->start_subject = subject;
|
mb->start_subject = subject;
|
||||||
|
@ -6423,7 +6390,7 @@ offsets, and the top third is working space. */
|
||||||
if (re->top_backref >= match_data->oveccount)
|
if (re->top_backref >= match_data->oveccount)
|
||||||
{
|
{
|
||||||
ocount = re->top_backref * 3 + 3;
|
ocount = re->top_backref * 3 + 3;
|
||||||
mb->ovector = (size_t *)(mb->memctl.malloc(ocount * sizeof(size_t),
|
mb->ovector = (PCRE2_OFFSET *)(mb->memctl.malloc(ocount * sizeof(PCRE2_OFFSET),
|
||||||
mb->memctl.memory_data));
|
mb->memctl.memory_data));
|
||||||
if (mb->ovector == NULL) return PCRE2_ERROR_NOMEMORY;
|
if (mb->ovector == NULL) return PCRE2_ERROR_NOMEMORY;
|
||||||
using_temporary_offsets = TRUE;
|
using_temporary_offsets = TRUE;
|
||||||
|
@ -6446,8 +6413,8 @@ in case they inspect these fields. */
|
||||||
|
|
||||||
if (ocount > 0)
|
if (ocount > 0)
|
||||||
{
|
{
|
||||||
register size_t *iptr = mb->ovector + ocount;
|
register PCRE2_OFFSET *iptr = mb->ovector + ocount;
|
||||||
register size_t *iend = iptr - re->top_bracket;
|
register PCRE2_OFFSET *iend = iptr - re->top_bracket;
|
||||||
if (iend < mb->ovector + 2) iend = mb->ovector + 2;
|
if (iend < mb->ovector + 2) iend = mb->ovector + 2;
|
||||||
while (--iptr >= iend) *iptr = PCRE2_UNSET;
|
while (--iptr >= iend) *iptr = PCRE2_UNSET;
|
||||||
mb->ovector[0] = mb->ovector[1] = PCRE2_UNSET;
|
mb->ovector[0] = mb->ovector[1] = PCRE2_UNSET;
|
||||||
|
@ -6812,7 +6779,7 @@ for(;;)
|
||||||
ENDLOOP:
|
ENDLOOP:
|
||||||
|
|
||||||
#ifdef NO_RECURSE
|
#ifdef NO_RECURSE
|
||||||
release_match_heapframes(&frame_zero);
|
release_match_heapframes(&frame_zero, mb);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Handle a fully successful match. */
|
/* Handle a fully successful match. */
|
||||||
|
@ -6833,7 +6800,7 @@ if (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
|
||||||
if (arg_offset_max >= 4)
|
if (arg_offset_max >= 4)
|
||||||
{
|
{
|
||||||
memcpy(match_data->ovector + 2, mb->ovector + 2,
|
memcpy(match_data->ovector + 2, mb->ovector + 2,
|
||||||
(arg_offset_max - 2) * sizeof(size_t));
|
(arg_offset_max - 2) * sizeof(PCRE2_OFFSET));
|
||||||
}
|
}
|
||||||
if (mb->end_offset_top > arg_offset_max) mb->capture_last |= OVFLBIT;
|
if (mb->end_offset_top > arg_offset_max) mb->capture_last |= OVFLBIT;
|
||||||
mb->memctl.free(mb->ovector, mb->memctl.memory_data);
|
mb->memctl.free(mb->ovector, mb->memctl.memory_data);
|
||||||
|
@ -6857,7 +6824,7 @@ if (rc == MATCH_MATCH || rc == MATCH_ACCEPT)
|
||||||
|
|
||||||
if (mb->end_offset_top/2 <= re->top_bracket)
|
if (mb->end_offset_top/2 <= re->top_bracket)
|
||||||
{
|
{
|
||||||
register size_t *iptr, *iend;
|
register PCRE2_OFFSET *iptr, *iend;
|
||||||
int resetcount = re->top_bracket + 1;
|
int resetcount = re->top_bracket + 1;
|
||||||
if (resetcount > match_data->oveccount) resetcount = match_data->oveccount;
|
if (resetcount > match_data->oveccount) resetcount = match_data->oveccount;
|
||||||
iptr = match_data->ovector + mb->end_offset_top;
|
iptr = match_data->ovector + mb->end_offset_top;
|
||||||
|
|
|
@ -52,10 +52,10 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
PCRE2_EXP_DEFN pcre2_match_data * PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN pcre2_match_data * PCRE2_CALL_CONVENTION
|
||||||
pcre2_match_data_create(size_t oveccount, pcre2_general_context *gcontext)
|
pcre2_match_data_create(uint32_t oveccount, pcre2_general_context *gcontext)
|
||||||
{
|
{
|
||||||
pcre2_match_data *yield = PRIV(memctl_malloc)(
|
pcre2_match_data *yield = PRIV(memctl_malloc)(
|
||||||
sizeof(pcre2_match_data) + 3*oveccount*sizeof(size_t),
|
sizeof(pcre2_match_data) + 3*oveccount*sizeof(PCRE2_OFFSET),
|
||||||
offsetof(pcre2_real_match_data, memctl), &(gcontext->memctl));
|
offsetof(pcre2_real_match_data, memctl), &(gcontext->memctl));
|
||||||
yield->oveccount = oveccount;
|
yield->oveccount = oveccount;
|
||||||
return yield;
|
return yield;
|
||||||
|
@ -94,7 +94,7 @@ if (match_data != NULL)
|
||||||
* Get left-most code unit in match *
|
* Get left-most code unit in match *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
PCRE2_EXP_DEFN size_t PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN PCRE2_OFFSET PCRE2_CALL_CONVENTION
|
||||||
pcre2_get_leftchar(pcre2_match_data *match_data)
|
pcre2_get_leftchar(pcre2_match_data *match_data)
|
||||||
{
|
{
|
||||||
return match_data->leftchar;
|
return match_data->leftchar;
|
||||||
|
@ -118,7 +118,7 @@ return match_data->mark;
|
||||||
* Get pointer to ovector *
|
* Get pointer to ovector *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
PCRE2_EXP_DEFN size_t * PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN PCRE2_OFFSET * PCRE2_CALL_CONVENTION
|
||||||
pcre2_get_ovector_pointer(pcre2_match_data *match_data)
|
pcre2_get_ovector_pointer(pcre2_match_data *match_data)
|
||||||
{
|
{
|
||||||
return match_data->ovector;
|
return match_data->ovector;
|
||||||
|
@ -130,7 +130,7 @@ return match_data->ovector;
|
||||||
* Get number of ovector slots *
|
* Get number of ovector slots *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
PCRE2_EXP_DEFN size_t PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN uint32_t PCRE2_CALL_CONVENTION
|
||||||
pcre2_get_ovector_count(pcre2_match_data *match_data)
|
pcre2_get_ovector_count(pcre2_match_data *match_data)
|
||||||
{
|
{
|
||||||
return match_data->oveccount;
|
return match_data->oveccount;
|
||||||
|
@ -142,7 +142,7 @@ return match_data->oveccount;
|
||||||
* Get right-most code unit in match *
|
* Get right-most code unit in match *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
PCRE2_EXP_DEFN size_t PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN PCRE2_OFFSET PCRE2_CALL_CONVENTION
|
||||||
pcre2_get_rightchar(pcre2_match_data *match_data)
|
pcre2_get_rightchar(pcre2_match_data *match_data)
|
||||||
{
|
{
|
||||||
return match_data->rightchar;
|
return match_data->rightchar;
|
||||||
|
@ -154,7 +154,7 @@ return match_data->rightchar;
|
||||||
* Get starting code unit in match *
|
* Get starting code unit in match *
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
PCRE2_EXP_DEFN size_t PCRE2_CALL_CONVENTION
|
PCRE2_EXP_DEFN PCRE2_OFFSET PCRE2_CALL_CONVENTION
|
||||||
pcre2_get_startchar(pcre2_match_data *match_data)
|
pcre2_get_startchar(pcre2_match_data *match_data)
|
||||||
{
|
{
|
||||||
return match_data->startchar;
|
return match_data->startchar;
|
||||||
|
|
|
@ -282,7 +282,7 @@ pcre2_printint(pcre2_code *re, FILE *f, BOOL print_lengths)
|
||||||
{
|
{
|
||||||
PCRE2_SPTR codestart, nametable, code;
|
PCRE2_SPTR codestart, nametable, code;
|
||||||
uint32_t options = re->compile_options;
|
uint32_t options = re->compile_options;
|
||||||
size_t nesize = re->name_entry_size;
|
uint32_t nesize = re->name_entry_size;
|
||||||
BOOL utf = (options & PCRE2_UTF) != 0;
|
BOOL utf = (options & PCRE2_UTF) != 0;
|
||||||
|
|
||||||
nametable = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code));
|
nametable = (PCRE2_SPTR)((uint8_t *)re + sizeof(pcre2_real_code));
|
||||||
|
|
|
@ -768,7 +768,7 @@ do
|
||||||
while (try_next) /* Loop for items in this branch */
|
while (try_next) /* Loop for items in this branch */
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
uint8_t *classmap;
|
uint8_t *classmap = NULL;
|
||||||
|
|
||||||
switch(*tcode)
|
switch(*tcode)
|
||||||
{
|
{
|
||||||
|
|
|
@ -322,10 +322,11 @@ pcre2_substring_list_get(pcre2_match_data *match_data, PCRE2_UCHAR ***listptr,
|
||||||
{
|
{
|
||||||
int i, count, count2;
|
int i, count, count2;
|
||||||
size_t size;
|
size_t size;
|
||||||
size_t *lensp, *ovector;
|
size_t *lensp;
|
||||||
pcre2_memctl *memp;
|
pcre2_memctl *memp;
|
||||||
PCRE2_UCHAR **listp;
|
PCRE2_UCHAR **listp;
|
||||||
PCRE2_UCHAR *sp;
|
PCRE2_UCHAR *sp;
|
||||||
|
PCRE2_OFFSET *ovector;
|
||||||
|
|
||||||
if ((count = match_data->rc) < 0) return count;
|
if ((count = match_data->rc) < 0) return count;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ strings. */
|
||||||
/* This function should never be called when UTF is not supported. */
|
/* This function should never be called when UTF is not supported. */
|
||||||
|
|
||||||
int
|
int
|
||||||
PRIV(valid_utf)(PCRE2_SPTR string, int length, size_t *erroroffset)
|
PRIV(valid_utf)(PCRE2_SPTR string, int length, PCRE2_OFFSET *erroroffset)
|
||||||
{
|
{
|
||||||
(void)string;
|
(void)string;
|
||||||
(void)length;
|
(void)length;
|
||||||
|
@ -89,7 +89,7 @@ Returns: == 0 if the string is a valid UTF string
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int
|
int
|
||||||
PRIV(valid_utf)(PCRE2_SPTR string, int length, size_t *erroroffset)
|
PRIV(valid_utf)(PCRE2_SPTR string, int length, PCRE2_OFFSET *erroroffset)
|
||||||
{
|
{
|
||||||
register PCRE2_SPTR p;
|
register PCRE2_SPTR p;
|
||||||
register uint32_t c;
|
register uint32_t c;
|
||||||
|
|
|
@ -77,10 +77,10 @@ int utf8;
|
||||||
uint32_t option_bits;
|
uint32_t option_bits;
|
||||||
uint32_t newline;
|
uint32_t newline;
|
||||||
|
|
||||||
size_t erroroffset;
|
PCRE2_OFFSET erroroffset;
|
||||||
size_t *ovector;
|
PCRE2_OFFSET *ovector;
|
||||||
size_t subject_length;
|
|
||||||
|
|
||||||
|
size_t subject_length;
|
||||||
pcre2_match_data *match_data;
|
pcre2_match_data *match_data;
|
||||||
|
|
||||||
|
|
||||||
|
@ -313,8 +313,8 @@ crlf_is_newline = newline == PCRE2_NEWLINE_ANY ||
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
uint32_t options = 0; /* Normally no options */
|
uint32_t options = 0; /* Normally no options */
|
||||||
size_t start_offset = ovector[1]; /* Start at end of previous match */
|
PCRE2_OFFSET start_offset = ovector[1]; /* Start at end of previous match */
|
||||||
|
|
||||||
/* If the previous match was for an empty string, we are finished if we are
|
/* If the previous match was for an empty string, we are finished if we are
|
||||||
at the end of the subject. Otherwise, arrange to run another match at the
|
at the end of the subject. Otherwise, arrange to run another match at the
|
||||||
|
|
|
@ -205,7 +205,7 @@ Returns: 0 on success
|
||||||
PCRE2POSIX_EXP_DEFN int PCRE2_CALL_CONVENTION
|
PCRE2POSIX_EXP_DEFN int PCRE2_CALL_CONVENTION
|
||||||
regcomp(regex_t *preg, const char *pattern, int cflags)
|
regcomp(regex_t *preg, const char *pattern, int cflags)
|
||||||
{
|
{
|
||||||
size_t erroffset;
|
PCRE2_OFFSET erroffset;
|
||||||
int errorcode;
|
int errorcode;
|
||||||
int options = 0;
|
int options = 0;
|
||||||
int re_nsub = 0;
|
int re_nsub = 0;
|
||||||
|
|
|
@ -45,8 +45,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
/* FIXME: These are the as-yet-unimplemented features:
|
/* FIXME: These are the as-yet-unimplemented features:
|
||||||
. save code and #load
|
. save code and #load
|
||||||
. JIT - compile, time, verify
|
. JIT - compile, time, verify
|
||||||
. find match limit
|
|
||||||
. show stack frame size
|
|
||||||
. memory handling testing
|
. memory handling testing
|
||||||
. stackguard testing
|
. stackguard testing
|
||||||
*/
|
*/
|
||||||
|
@ -407,11 +405,11 @@ enum { CTX_PAT, /* Active pattern context */
|
||||||
name because it is searched by binary chop. */
|
name because it is searched by binary chop. */
|
||||||
|
|
||||||
typedef struct modstruct {
|
typedef struct modstruct {
|
||||||
const char *name;
|
const char *name;
|
||||||
uint16_t which;
|
uint16_t which;
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
size_t offset;
|
PCRE2_OFFSET offset;
|
||||||
} modstruct;
|
} modstruct;
|
||||||
|
|
||||||
static modstruct modlist[] = {
|
static modstruct modlist[] = {
|
||||||
|
@ -847,7 +845,7 @@ are supported. */
|
||||||
else if (test_mode == PCRE16_MODE) \
|
else if (test_mode == PCRE16_MODE) \
|
||||||
pcre2_set_recursion_limit_16(G(a,16),b); \
|
pcre2_set_recursion_limit_16(G(a,16),b); \
|
||||||
else \
|
else \
|
||||||
pcre2_set_match_limit_32(G(a,32),b)
|
pcre2_set_recursion_limit_32(G(a,32),b)
|
||||||
|
|
||||||
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
#define PCRE2_SUBSTRING_COPY_BYNAME(a,b,c,d,e) \
|
||||||
if (test_mode == PCRE8_MODE) \
|
if (test_mode == PCRE8_MODE) \
|
||||||
|
@ -1016,9 +1014,9 @@ the three different cases. */
|
||||||
|
|
||||||
#define PCHARS(lv, p, offset, len, utf, f) \
|
#define PCHARS(lv, p, offset, len, utf, f) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
lv = G(pchars,BITONE)(p, offset, len, utf, f); \
|
lv = G(pchars,BITONE)((G(PCRE2_SPTR,BITONE))(p)+offset, len, utf, f); \
|
||||||
else \
|
else \
|
||||||
lv = G(PCHARS,BITTWO)(p, offset, len, utf, f)
|
lv = G(PCHARS,BITTWO)((G(PCRE2_SPTR,BITTWO))(p)+offset, len, utf, f)
|
||||||
|
|
||||||
#define PCHARSV(p, offset, len, utf, f) \
|
#define PCHARSV(p, offset, len, utf, f) \
|
||||||
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
if (test_mode == G(G(PCRE,BITONE),_MODE)) \
|
||||||
|
@ -1229,7 +1227,7 @@ the three different cases. */
|
||||||
#define FLD(a,b) G(a,8)->b
|
#define FLD(a,b) G(a,8)->b
|
||||||
#define PATCTXCPY(a,b) memcpy(G(a,8),G(b,8),sizeof(pcre2_compile_context_8))
|
#define PATCTXCPY(a,b) memcpy(G(a,8),G(b,8),sizeof(pcre2_compile_context_8))
|
||||||
#define PCHARS(lv, p, offset, len, utf, f) \
|
#define PCHARS(lv, p, offset, len, utf, f) \
|
||||||
lv = pchars8(p, offset, len, utf, f)
|
lv = pchars8((PCRE2_SPTR8)(p)+offset, len, utf, f)
|
||||||
#define PCHARSV(p, offset, len, utf, f) \
|
#define PCHARSV(p, offset, len, utf, f) \
|
||||||
(void)pchars8((PCRE2_SPTR8)(p)+offset, len, utf, f)
|
(void)pchars8((PCRE2_SPTR8)(p)+offset, len, utf, f)
|
||||||
#define PCRE2_COMPILE(a,b,c,d,e,f,g) \
|
#define PCRE2_COMPILE(a,b,c,d,e,f,g) \
|
||||||
|
@ -1286,7 +1284,7 @@ the three different cases. */
|
||||||
#define FLD(a,b) G(a,16)->b
|
#define FLD(a,b) G(a,16)->b
|
||||||
#define PATCTXCPY(a,b) memcpy(G(a,16),G(b,16),sizeof(pcre2_compile_context_16))
|
#define PATCTXCPY(a,b) memcpy(G(a,16),G(b,16),sizeof(pcre2_compile_context_16))
|
||||||
#define PCHARS(lv, p, offset, len, utf, f) \
|
#define PCHARS(lv, p, offset, len, utf, f) \
|
||||||
lv = pchars16(p, offset, len, utf, f)
|
lv = pchars16((PCRE2_SPTR16)(p)+offset, len, utf, f)
|
||||||
#define PCHARSV(p, offset, len, utf, f) \
|
#define PCHARSV(p, offset, len, utf, f) \
|
||||||
(void)pchars16((PCRE2_SPTR16)(p)+offset, len, utf, f)
|
(void)pchars16((PCRE2_SPTR16)(p)+offset, len, utf, f)
|
||||||
#define PCRE2_COMPILE(a,b,c,d,e,f,g) \
|
#define PCRE2_COMPILE(a,b,c,d,e,f,g) \
|
||||||
|
@ -1343,7 +1341,7 @@ the three different cases. */
|
||||||
#define FLD(a,b) G(a,32)->b
|
#define FLD(a,b) G(a,32)->b
|
||||||
#define PATCTXCPY(a,b) memcpy(G(a,32),G(b,32),sizeof(pcre2_compile_context_32))
|
#define PATCTXCPY(a,b) memcpy(G(a,32),G(b,32),sizeof(pcre2_compile_context_32))
|
||||||
#define PCHARS(lv, p, offset, len, utf, f) \
|
#define PCHARS(lv, p, offset, len, utf, f) \
|
||||||
lv = pchars32(p, offset, len, utf, f)
|
lv = pchars32((PCRE2_SPTR32)(p)+offset, len, utf, f)
|
||||||
#define PCHARSV(p, offset, len, utf, f) \
|
#define PCHARSV(p, offset, len, utf, f) \
|
||||||
(void)pchars32((PCRE2_SPTR32)(p)+offset, len, utf, f)
|
(void)pchars32((PCRE2_SPTR32)(p)+offset, len, utf, f)
|
||||||
#define PCRE2_COMPILE(a,b,c,d,e,f,g) \
|
#define PCRE2_COMPILE(a,b,c,d,e,f,g) \
|
||||||
|
@ -1748,23 +1746,24 @@ free(block);
|
||||||
|
|
||||||
/* For recursion malloc/free, to test stacking calls */
|
/* For recursion malloc/free, to test stacking calls */
|
||||||
|
|
||||||
#ifdef FIXME
|
#ifdef NO_RECURSE
|
||||||
static void *stack_malloc(size_t size)
|
static void *my_stack_malloc(size_t size, void *data)
|
||||||
{
|
{
|
||||||
void *block = malloc(size);
|
void *block = malloc(size);
|
||||||
|
(void)data;
|
||||||
if (show_memory)
|
if (show_memory)
|
||||||
fprintf(outfile, "stack_malloc %3d %p\n", (int)size, block);
|
fprintf(outfile, "stack_malloc %3d %p\n", (int)size, block);
|
||||||
return block;
|
return block;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void stack_free(void *block)
|
static void my_stack_free(void *block, void *data)
|
||||||
{
|
{
|
||||||
|
(void)data;
|
||||||
if (show_memory)
|
if (show_memory)
|
||||||
fprintf(outfile, "stack_free %p\n", block);
|
fprintf(outfile, "stack_free %p\n", block);
|
||||||
free(block);
|
free(block);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* NO_RECURSE */
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
|
@ -2383,7 +2382,7 @@ static void *
|
||||||
check_modifier(modstruct *m, int ctx, patctl *pctl, datctl *dctl, uint32_t c)
|
check_modifier(modstruct *m, int ctx, patctl *pctl, datctl *dctl, uint32_t c)
|
||||||
{
|
{
|
||||||
void *field = NULL;
|
void *field = NULL;
|
||||||
size_t offset = m->offset;
|
PCRE2_OFFSET offset = m->offset;
|
||||||
|
|
||||||
if (restrict_for_perl_test) switch(m->which)
|
if (restrict_for_perl_test) switch(m->which)
|
||||||
{
|
{
|
||||||
|
@ -2409,7 +2408,7 @@ switch (m->which)
|
||||||
/* Fall through for something that can also be in a match context. In this
|
/* Fall through for something that can also be in a match context. In this
|
||||||
case the offset is taken from the other field. */
|
case the offset is taken from the other field. */
|
||||||
|
|
||||||
offset = (size_t)(m->value);
|
offset = (PCRE2_OFFSET)(m->value);
|
||||||
|
|
||||||
case MOD_CTM: /* Match context modifier */
|
case MOD_CTM: /* Match context modifier */
|
||||||
if (ctx == CTX_DEFDAT || ctx == CTX_DEFANY) field = PTR(default_dat_context);
|
if (ctx == CTX_DEFDAT || ctx == CTX_DEFANY) field = PTR(default_dat_context);
|
||||||
|
@ -3373,7 +3372,7 @@ uint8_t *p = buffer;
|
||||||
const uint8_t *use_tables;
|
const uint8_t *use_tables;
|
||||||
unsigned int delimiter = *p++;
|
unsigned int delimiter = *p++;
|
||||||
int patlen, errorcode;
|
int patlen, errorcode;
|
||||||
size_t erroroffset;
|
PCRE2_OFFSET erroroffset;
|
||||||
|
|
||||||
/* Initialize the context and pattern/data controls for this test from the
|
/* Initialize the context and pattern/data controls for this test from the
|
||||||
defaults. */
|
defaults. */
|
||||||
|
@ -3761,6 +3760,9 @@ uint32_t min = 0;
|
||||||
uint32_t mid = 64;
|
uint32_t mid = 64;
|
||||||
uint32_t max = UINT32_MAX;
|
uint32_t max = UINT32_MAX;
|
||||||
|
|
||||||
|
PCRE2_SET_MATCH_LIMIT(dat_context, max);
|
||||||
|
PCRE2_SET_RECURSION_LIMIT(dat_context, max);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (errnumber == PCRE2_ERROR_MATCHLIMIT)
|
if (errnumber == PCRE2_ERROR_MATCHLIMIT)
|
||||||
|
@ -3948,13 +3950,13 @@ size_t needlen;
|
||||||
BOOL utf;
|
BOOL utf;
|
||||||
|
|
||||||
#ifdef SUPPORT_PCRE8
|
#ifdef SUPPORT_PCRE8
|
||||||
uint8_t *q8;
|
uint8_t *q8 = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUPPORT_PCRE16
|
#ifdef SUPPORT_PCRE16
|
||||||
uint16_t *q16;
|
uint16_t *q16 = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef SUPPORT_PCRE32
|
#ifdef SUPPORT_PCRE32
|
||||||
uint32_t *q32;
|
uint32_t *q32 = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Copy the default context and data control blocks to the active ones. Then
|
/* Copy the default context and data control blocks to the active ones. Then
|
||||||
|
@ -4520,7 +4522,7 @@ set in the datctl block.
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
uint8_t *nptr;
|
uint8_t *nptr;
|
||||||
size_t *ovector;
|
PCRE2_OFFSET *ovector;
|
||||||
|
|
||||||
/* This is a check against a lunatic return value. */
|
/* This is a check against a lunatic return value. */
|
||||||
|
|
||||||
|
@ -4555,8 +4557,8 @@ set in the datctl block.
|
||||||
ovector = FLD(match_data, ovector);
|
ovector = FLD(match_data, ovector);
|
||||||
for (i = 0; i < 2*capcount; i += 2)
|
for (i = 0; i < 2*capcount; i += 2)
|
||||||
{
|
{
|
||||||
size_t start = ovector[i];
|
PCRE2_OFFSET start = ovector[i];
|
||||||
size_t end = ovector[i+1];
|
PCRE2_OFFSET end = ovector[i+1];
|
||||||
|
|
||||||
if (start > end)
|
if (start > end)
|
||||||
{
|
{
|
||||||
|
@ -4738,7 +4740,7 @@ set in the datctl block.
|
||||||
|
|
||||||
else if (capcount == PCRE2_ERROR_PARTIAL)
|
else if (capcount == PCRE2_ERROR_PARTIAL)
|
||||||
{
|
{
|
||||||
size_t leftchar = FLD(match_data, leftchar);
|
PCRE2_OFFSET leftchar = FLD(match_data, leftchar);
|
||||||
|
|
||||||
fprintf(outfile, "Partial match");
|
fprintf(outfile, "Partial match");
|
||||||
if (leftchar != FLD(match_data, startchar))
|
if (leftchar != FLD(match_data, startchar))
|
||||||
|
@ -4781,8 +4783,8 @@ set in the datctl block.
|
||||||
else if (g_notempty != 0) /* There was a previous null match */
|
else if (g_notempty != 0) /* There was a previous null match */
|
||||||
{
|
{
|
||||||
uint16_t nl = FLD(compiled_code, newline_convention);
|
uint16_t nl = FLD(compiled_code, newline_convention);
|
||||||
size_t start_offset = dat_datctl.offset; /* Where the match was */
|
PCRE2_OFFSET start_offset = dat_datctl.offset; /* Where the match was */
|
||||||
size_t end_offset = start_offset + 1;
|
PCRE2_OFFSET end_offset = start_offset + 1;
|
||||||
|
|
||||||
if ((nl == PCRE2_NEWLINE_CRLF || nl == PCRE2_NEWLINE_ANY ||
|
if ((nl == PCRE2_NEWLINE_CRLF || nl == PCRE2_NEWLINE_ANY ||
|
||||||
nl == PCRE2_NEWLINE_ANYCRLF) &&
|
nl == PCRE2_NEWLINE_ANYCRLF) &&
|
||||||
|
@ -4857,7 +4859,7 @@ set in the datctl block.
|
||||||
|
|
||||||
if ((dat_datctl.control & CTL_ANYGLOB) == 0) break; else
|
if ((dat_datctl.control & CTL_ANYGLOB) == 0) break; else
|
||||||
{
|
{
|
||||||
size_t end_offset = FLD(match_data, ovector)[1];
|
PCRE2_OFFSET end_offset = FLD(match_data, ovector)[1];
|
||||||
|
|
||||||
/* We must now set up for the next iteration of a global search. If we have
|
/* We must now set up for the next iteration of a global search. If we have
|
||||||
matched an empty string, first check to see if we are at the end of the
|
matched an empty string, first check to see if we are at the end of the
|
||||||
|
@ -5069,7 +5071,7 @@ if (arg != NULL)
|
||||||
/* No argument for -C: output all configuration information. */
|
/* No argument for -C: output all configuration information. */
|
||||||
|
|
||||||
print_version(stdout);
|
print_version(stdout);
|
||||||
printf("\nCompiled with\n");
|
printf("Compiled with\n");
|
||||||
|
|
||||||
#ifdef EBCDIC
|
#ifdef EBCDIC
|
||||||
printf(" EBCDIC code support: LF is 0x%02x\n", CHAR_LF);
|
printf(" EBCDIC code support: LF is 0x%02x\n", CHAR_LF);
|
||||||
|
@ -5117,14 +5119,6 @@ printf(" Default recursion depth limit = %ld\n", lrc);
|
||||||
(void)PCRE2_CONFIG(PCRE2_CONFIG_STACKRECURSE, &rc, sizeof(rc));
|
(void)PCRE2_CONFIG(PCRE2_CONFIG_STACKRECURSE, &rc, sizeof(rc));
|
||||||
printf(" Match recursion uses %s", rc? "stack" : "heap");
|
printf(" Match recursion uses %s", rc? "stack" : "heap");
|
||||||
|
|
||||||
#ifdef FIXME
|
|
||||||
if (showstore)
|
|
||||||
{
|
|
||||||
PCRE_EXEC(stack_size, NULL, NULL, NULL, -999, -999, 0, NULL, 0);
|
|
||||||
printf(": %sframe size = %d bytes", rc? "approximate " : "", -stack_size);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -5361,6 +5355,10 @@ if (test_mode == PCRE8_MODE)
|
||||||
default_dat_context8 = pcre2_match_context_create_8(general_context8);
|
default_dat_context8 = pcre2_match_context_create_8(general_context8);
|
||||||
dat_context8 = pcre2_match_context_create_8(general_context8);
|
dat_context8 = pcre2_match_context_create_8(general_context8);
|
||||||
match_data8 = pcre2_match_data_create_8(max_oveccount, general_context8);
|
match_data8 = pcre2_match_data_create_8(max_oveccount, general_context8);
|
||||||
|
#ifdef NO_RECURSE
|
||||||
|
(void)pcre2_set_recursion_memory_management_8(default_dat_context8,
|
||||||
|
&my_stack_malloc, &my_stack_free, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5374,6 +5372,10 @@ if (test_mode == PCRE16_MODE)
|
||||||
default_dat_context16 = pcre2_match_context_create_16(general_context16);
|
default_dat_context16 = pcre2_match_context_create_16(general_context16);
|
||||||
dat_context16 = pcre2_match_context_create_16(general_context16);
|
dat_context16 = pcre2_match_context_create_16(general_context16);
|
||||||
match_data16 = pcre2_match_data_create_16(max_oveccount, general_context16);
|
match_data16 = pcre2_match_data_create_16(max_oveccount, general_context16);
|
||||||
|
#ifdef NO_RECURSE
|
||||||
|
(void)pcre2_set_recursion_memory_management_16(default_dat_context16,
|
||||||
|
&my_stack_malloc, &my_stack_free, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -5387,6 +5389,10 @@ if (test_mode == PCRE32_MODE)
|
||||||
default_dat_context32 = pcre2_match_context_create_32(general_context32);
|
default_dat_context32 = pcre2_match_context_create_32(general_context32);
|
||||||
dat_context32 = pcre2_match_context_create_32(general_context32);
|
dat_context32 = pcre2_match_context_create_32(general_context32);
|
||||||
match_data32 = pcre2_match_data_create_32(max_oveccount, general_context32);
|
match_data32 = pcre2_match_data_create_32(max_oveccount, general_context32);
|
||||||
|
#ifdef NO_RECURSE
|
||||||
|
(void)pcre2_set_recursion_memory_management_32(default_dat_context32,
|
||||||
|
&my_stack_malloc, &my_stack_free, NULL);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue