Set the callout block version back to 0 for this new project and re-order the

fields.
This commit is contained in:
Philip.Hazel 2014-09-19 17:38:26 +00:00
parent eee8530add
commit 24c0018125
3 changed files with 26 additions and 28 deletions

View File

@ -313,22 +313,20 @@ 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 */ \ uint32_t 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 */ \
uint32_t capture_top; /* Max current capture */ \
uint32_t capture_last; /* Most recently closed capture */ \
void *callout_data; /* Data passed in with the call */ \
PCRE2_SIZE *offset_vector; /* The offset vector */ \ PCRE2_SIZE *offset_vector; /* The offset vector */ \
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
PCRE2_SPTR subject; /* The subject being matched */ \ PCRE2_SPTR subject; /* The subject being matched */ \
PCRE2_SIZE subject_length; /* The length of the subject */ \ PCRE2_SIZE subject_length; /* The length of the subject */ \
PCRE2_SIZE start_match; /* Offset to start of this match attempt */ \ PCRE2_SIZE start_match; /* Offset to start of this match attempt */ \
PCRE2_SIZE current_position; /* Where we currently are in the subject */ \ PCRE2_SIZE 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_SIZE pattern_position; /* Offset to next item in the pattern */ \ PCRE2_SIZE pattern_position; /* Offset to next item in the pattern */ \
PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \ PCRE2_SIZE next_item_length; /* Length of next item in the pattern */ \
/* ------------------- Added for Version 2 -------------------------- */ \
PCRE2_SPTR mark; /* Pointer to current mark or NULL */ \
/* ------------------------------------------------------------------ */ \ /* ------------------------------------------------------------------ */ \
} pcre2_callout_block; } pcre2_callout_block;
@ -641,7 +639,7 @@ PCRE2_SUFFIX a no-op. Otherwise, generate an error. */
#define PCRE2_SUFFIX(a) a #define PCRE2_SUFFIX(a) a
#else #else
#error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32. #error PCRE2_CODE_UNIT_WIDTH must be 0, 8, 16, or 32.
#endif #endif
#endif /* PCRE2_CODE_UNIT_WIDTH is defined */ #endif /* PCRE2_CODE_UNIT_WIDTH is defined */
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -2612,19 +2612,19 @@ for (;;)
if (mb->callout != NULL) if (mb->callout != NULL)
{ {
pcre2_callout_block cb; pcre2_callout_block cb;
cb.version = 1; /* Version 1 of the callout block */ cb.version = 0;
cb.callout_number = code[LINK_SIZE+2]; cb.callout_number = code[LINK_SIZE+2];
cb.capture_top = 1;
cb.capture_last = 0;
cb.callout_data = mb->callout_data;
cb.offset_vector = offsets; cb.offset_vector = offsets;
cb.mark = NULL; /* No (*MARK) support */
cb.subject = start_subject; cb.subject = start_subject;
cb.subject_length = (PCRE2_SIZE)(end_subject - start_subject); cb.subject_length = (PCRE2_SIZE)(end_subject - start_subject);
cb.start_match = (PCRE2_SIZE)(current_subject - start_subject); cb.start_match = (PCRE2_SIZE)(current_subject - start_subject);
cb.current_position = (PCRE2_SIZE)(ptr - start_subject); cb.current_position = (PCRE2_SIZE)(ptr - start_subject);
cb.pattern_position = GET(code, LINK_SIZE + 3); cb.pattern_position = GET(code, LINK_SIZE + 3);
cb.next_item_length = GET(code, 3 + 2*LINK_SIZE); cb.next_item_length = GET(code, 3 + 2*LINK_SIZE);
cb.capture_top = 1;
cb.capture_last = -1;
cb.callout_data = mb->callout_data;
cb.mark = NULL; /* No (*MARK) support */
if ((rrc = (mb->callout)(&cb)) < 0) return rrc; /* Abandon */ if ((rrc = (mb->callout)(&cb)) < 0) return rrc; /* Abandon */
} }
if (rrc > 0) break; /* Fail this thread */ if (rrc > 0) break; /* Fail this thread */
@ -2959,19 +2959,19 @@ for (;;)
if (mb->callout != NULL) if (mb->callout != NULL)
{ {
pcre2_callout_block cb; pcre2_callout_block cb;
cb.version = 1; /* Version 1 of the callout block */ cb.version = 0;
cb.callout_number = code[1]; cb.callout_number = code[1];
cb.capture_top = 1;
cb.capture_last = 0;
cb.callout_data = mb->callout_data;
cb.offset_vector = offsets; cb.offset_vector = offsets;
cb.mark = NULL; /* No (*MARK) support */
cb.subject = start_subject; cb.subject = start_subject;
cb.subject_length = (PCRE2_SIZE)(end_subject - start_subject); cb.subject_length = (PCRE2_SIZE)(end_subject - start_subject);
cb.start_match = (PCRE2_SIZE)(current_subject - start_subject); cb.start_match = (PCRE2_SIZE)(current_subject - start_subject);
cb.current_position = (PCRE2_SIZE)(ptr - start_subject); cb.current_position = (PCRE2_SIZE)(ptr - start_subject);
cb.pattern_position = GET(code, 2); cb.pattern_position = GET(code, 2);
cb.next_item_length = GET(code, 2 + LINK_SIZE); cb.next_item_length = GET(code, 2 + LINK_SIZE);
cb.capture_top = 1;
cb.capture_last = -1;
cb.callout_data = mb->callout_data;
cb.mark = NULL; /* No (*MARK) support */
if ((rrc = (mb->callout)(&cb)) < 0) return rrc; /* Abandon */ if ((rrc = (mb->callout)(&cb)) < 0) return rrc; /* Abandon */
} }
if (rrc == 0) if (rrc == 0)

View File

@ -1307,19 +1307,19 @@ for (;;)
if (mb->callout != NULL) if (mb->callout != NULL)
{ {
pcre2_callout_block cb; pcre2_callout_block cb;
cb.version = 2; /* Version 1 of the callout block */ cb.version = 0;
cb.callout_number = ecode[1]; cb.callout_number = ecode[1];
cb.capture_top = offset_top/2;
cb.capture_last = mb->capture_last & CAPLMASK;
cb.callout_data = mb->callout_data;
cb.offset_vector = mb->ovector; cb.offset_vector = mb->ovector;
cb.mark = mb->nomatch_mark;
cb.subject = mb->start_subject; cb.subject = mb->start_subject;
cb.subject_length = (PCRE2_SIZE)(mb->end_subject - mb->start_subject); cb.subject_length = (PCRE2_SIZE)(mb->end_subject - mb->start_subject);
cb.start_match = (PCRE2_SIZE)(mstart - mb->start_subject); cb.start_match = (PCRE2_SIZE)(mstart - mb->start_subject);
cb.current_position = (PCRE2_SIZE)(eptr - mb->start_subject); cb.current_position = (PCRE2_SIZE)(eptr - mb->start_subject);
cb.pattern_position = GET(ecode, 2); cb.pattern_position = GET(ecode, 2);
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
cb.capture_top = offset_top/2;
cb.capture_last = mb->capture_last & CAPLMASK;
cb.callout_data = mb->callout_data;
cb.mark = mb->nomatch_mark;
if ((rrc = mb->callout(&cb)) > 0) RRETURN(MATCH_NOMATCH); if ((rrc = mb->callout(&cb)) > 0) RRETURN(MATCH_NOMATCH);
if (rrc < 0) RRETURN(rrc); if (rrc < 0) RRETURN(rrc);
} }
@ -1697,19 +1697,19 @@ for (;;)
if (mb->callout != NULL) if (mb->callout != NULL)
{ {
pcre2_callout_block cb; pcre2_callout_block cb;
cb.version = 2; /* Version 1 of the callout block */ cb.version = 0;
cb.callout_number = ecode[1]; cb.callout_number = ecode[1];
cb.capture_top = offset_top/2;
cb.capture_last = mb->capture_last & CAPLMASK;
cb.callout_data = mb->callout_data;
cb.offset_vector = mb->ovector; cb.offset_vector = mb->ovector;
cb.mark = mb->nomatch_mark;
cb.subject = mb->start_subject; cb.subject = mb->start_subject;
cb.subject_length = (PCRE2_SIZE)(mb->end_subject - mb->start_subject); cb.subject_length = (PCRE2_SIZE)(mb->end_subject - mb->start_subject);
cb.start_match = (PCRE2_SIZE)(mstart - mb->start_subject); cb.start_match = (PCRE2_SIZE)(mstart - mb->start_subject);
cb.current_position = (PCRE2_SIZE)(eptr - mb->start_subject); cb.current_position = (PCRE2_SIZE)(eptr - mb->start_subject);
cb.pattern_position = GET(ecode, 2); cb.pattern_position = GET(ecode, 2);
cb.next_item_length = GET(ecode, 2 + LINK_SIZE); cb.next_item_length = GET(ecode, 2 + LINK_SIZE);
cb.capture_top = offset_top/2;
cb.capture_last = mb->capture_last & CAPLMASK;
cb.callout_data = mb->callout_data;
cb.mark = mb->nomatch_mark;
if ((rrc = mb->callout(&cb)) > 0) RRETURN(MATCH_NOMATCH); if ((rrc = mb->callout(&cb)) > 0) RRETURN(MATCH_NOMATCH);
if (rrc < 0) RRETURN(rrc); if (rrc < 0) RRETURN(rrc);
} }