From a119d6f974e3d001e04cd1ded4ccf720d43eaf1a Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Mon, 1 Dec 2014 16:14:53 +0000 Subject: [PATCH] (1) uint32_t for substring number args; (2) correct PRIV(memctl_malloc) definition for Windows; (3) remove unwanted PCRE2_EXP_DATA_DEFN; (4) documentation updates. --- configure.ac | 2 +- doc/html/pcre2_pattern_info.html | 35 ++++++++++-------- doc/html/pcre2_substring_copy_bynumber.html | 2 +- doc/html/pcre2_substring_get_bynumber.html | 6 +-- doc/html/pcre2_substring_length_bynumber.html | 2 +- doc/html/pcre2api.html | 14 +++---- doc/pcre2.txt | 14 +++---- doc/pcre2_pattern_info.3 | 37 ++++++++++--------- doc/pcre2_substring_copy_bynumber.3 | 4 +- doc/pcre2_substring_get_bynumber.3 | 8 ++-- doc/pcre2_substring_length_bynumber.3 | 4 +- doc/pcre2api.3 | 16 ++++---- src/pcre2.h.in | 6 +-- src/pcre2_context.c | 2 +- src/pcre2_internal.h | 27 ++++---------- src/pcre2_substring.c | 12 +++--- 16 files changed, 93 insertions(+), 98 deletions(-) diff --git a/configure.ac b/configure.ac index bfb7cf9..6bdc1d0 100644 --- a/configure.ac +++ b/configure.ac @@ -10,7 +10,7 @@ dnl be defined as -RC2, for example. For real releases, it should be empty. m4_define(pcre2_major, [10]) m4_define(pcre2_minor, [00]) -m4_define(pcre2_prerelease, [-RC1]) +m4_define(pcre2_prerelease, [-RC2]) m4_define(pcre2_date, [2014-11-28]) # NOTE: The CMakeLists.txt file searches for the above variables in the first diff --git a/doc/html/pcre2_pattern_info.html b/doc/html/pcre2_pattern_info.html index 6aae36e..4e007ee 100644 --- a/doc/html/pcre2_pattern_info.html +++ b/doc/html/pcre2_pattern_info.html @@ -27,19 +27,19 @@ DESCRIPTION

This function returns information about a compiled pattern. Its arguments are:

-  code                      Compiled regular expression
-  what                      What information is required
-  where                     Where to put the information
+  code     Pointer to a compiled regular expression
+  what     What information is required
+  where    Where to put the information
 
-If where is NULL, the function returns the amount of memory needed for -the requested information, in bytes. The following information is available: +The recognized values for the what argument, and the information they +request are as follows:
   PCRE2_INFO_ALLOPTIONS      Final options after compiling
   PCRE2_INFO_ARGOPTIONS      Options passed to pcre2_compile()
   PCRE2_INFO_BACKREFMAX      Number of highest back reference
-  PCRE2_INFO_BSR             What \R matches
-                               0 all Unicode line endings
-                               1 CR, LF, or CRLF only
+  PCRE2_INFO_BSR             What \R matches:
+                               PCRE2_BSR_UNICODE: Unicode line endings
+                               PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only
   PCRE2_INFO_CAPTURECOUNT    Number of capturing subpatterns
   PCRE2_INFO_FIRSTBITMAP     Bitmap of first code units, or NULL
   PCRE2_INFO_FIRSTCODEUNIT   First code unit when type is 1
@@ -58,7 +58,7 @@ the requested information, in bytes. The following information is available:
   PCRE2_INFO_MATCHEMPTY      1 if the pattern can match an
                                empty string, 0 otherwise
   PCRE2_INFO_MATCHLIMIT      Match limit if set,
-                               otherwise PCRE2_RROR_UNSET
+                               otherwise PCRE2_ERROR_UNSET
   PCRE2_INFO_MAXLOOKBEHIND   Length (in characters) of the longest
                                lookbehind assertion
   PCRE2_INFO_MINLENGTH       Lower bound length of matching strings
@@ -66,17 +66,20 @@ the requested information, in bytes. The following information is available:
   PCRE2_INFO_NAMECOUNT       Number of named subpatterns
   PCRE2_INFO_NAMETABLE       Pointer to name table
   PCRE2_CONFIG_NEWLINE       Code for the newline sequence:
-                               1    for CR
-                               2    for LF
-                               3    for CRLF
-                               4    for ANY
-                               5    for ANYCRLF
+                               PCRE2_NEWLINE_CR
+                               PCRE2_NEWLINE_LF
+                               PCRE2_NEWLINE_CRLF
+                               PCRE2_NEWLINE_ANY
+                               PCRE2_NEWLINE_ANYCRLF
   PCRE2_INFO_RECURSIONLIMIT  Recursion limit if set,
                                otherwise PCRE2_ERROR_UNSET
   PCRE2_INFO_SIZE            Size of compiled pattern
 
-The where argument must point to an unsigned 32-bit integer (uint32_t -variable), except for the following what values: +If where is NULL, the function returns the amount of memory needed for +the requested information, in bytes. Otherwise, the where argument must +point to an unsigned 32-bit integer (uint32_t variable), except for the +following what values, when it must point to a variable of the type +shown:
   PCRE2_INFO_FIRSTBITMAP     const uint8_t *
   PCRE2_INFO_JITSIZE         size_t
diff --git a/doc/html/pcre2_substring_copy_bynumber.html b/doc/html/pcre2_substring_copy_bynumber.html
index d54015c..0afeecc 100644
--- a/doc/html/pcre2_substring_copy_bynumber.html
+++ b/doc/html/pcre2_substring_copy_bynumber.html
@@ -20,7 +20,7 @@ SYNOPSIS
 

int pcre2_substring_copy_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR *buffer, + uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen);


diff --git a/doc/html/pcre2_substring_get_bynumber.html b/doc/html/pcre2_substring_get_bynumber.html index 7173279..5c4ff7c 100644 --- a/doc/html/pcre2_substring_get_bynumber.html +++ b/doc/html/pcre2_substring_get_bynumber.html @@ -20,14 +20,14 @@ SYNOPSIS

int pcre2_substring_get_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen); + uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen);


DESCRIPTION

-This is a convenience function for extracting a captured substring by number into -newly acquired memory. The arguments are: +This is a convenience function for extracting a captured substring by number +into newly acquired memory. The arguments are:

   match_data    The match data for the match
   number        Number of the required substring
diff --git a/doc/html/pcre2_substring_length_bynumber.html b/doc/html/pcre2_substring_length_bynumber.html
index 654e049..15aa0e3 100644
--- a/doc/html/pcre2_substring_length_bynumber.html
+++ b/doc/html/pcre2_substring_length_bynumber.html
@@ -20,7 +20,7 @@ SYNOPSIS
 

int pcre2_substring_length_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_SIZE *length); + uint32_t number, PCRE2_SIZE *length);


DESCRIPTION diff --git a/doc/html/pcre2api.html b/doc/html/pcre2api.html index 94206c7..9877b8a 100644 --- a/doc/html/pcre2api.html +++ b/doc/html/pcre2api.html @@ -189,7 +189,7 @@ document for an overview of all the PCRE2 documentation.

int pcre2_substring_copy_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR *buffer, + uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen);

@@ -201,7 +201,7 @@ document for an overview of all the PCRE2 documentation.

int pcre2_substring_get_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR **bufferptr, + uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen);

@@ -210,7 +210,7 @@ document for an overview of all the PCRE2 documentation.

int pcre2_substring_length_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_SIZE *length); + uint32_t number, PCRE2_SIZE *length);

int pcre2_substring_nametable_scan(const pcre2_code *code, @@ -2214,16 +2214,16 @@ The internal recursion limit was reached.
EXTRACTING CAPTURED SUBSTRINGS BY NUMBER

int pcre2_substring_length_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_SIZE *length); + uint32_t number, PCRE2_SIZE *length);

int pcre2_substring_copy_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR *buffer, + uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen);

int pcre2_substring_get_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR **bufferptr, + uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen);

@@ -2685,7 +2685,7 @@ Cambridge, England.


REVISION

-Last updated: 27 November 2014 +Last updated: 01 December 2014
Copyright © 1997-2014 University of Cambridge.
diff --git a/doc/pcre2.txt b/doc/pcre2.txt index 0f3e644..4610e3e 100644 --- a/doc/pcre2.txt +++ b/doc/pcre2.txt @@ -283,7 +283,7 @@ PCRE2 NATIVE API STRING EXTRACTION FUNCTIONS PCRE2_SPTR name, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen); int pcre2_substring_copy_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR *buffer, + uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen); void pcre2_substring_free(PCRE2_UCHAR *buffer); @@ -292,14 +292,14 @@ PCRE2 NATIVE API STRING EXTRACTION FUNCTIONS PCRE2_SPTR name, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen); int pcre2_substring_get_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR **bufferptr, + uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen); int pcre2_substring_length_byname(pcre2_match_data *match_data, PCRE2_SPTR name, PCRE2_SIZE *length); int pcre2_substring_length_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_SIZE *length); + uint32_t number, PCRE2_SIZE *length); int pcre2_substring_nametable_scan(const pcre2_code *code, PCRE2_SPTR name, PCRE2_SPTR *first, PCRE2_SPTR *last); @@ -2189,14 +2189,14 @@ ERROR RETURNS FROM pcre2_match() EXTRACTING CAPTURED SUBSTRINGS BY NUMBER int pcre2_substring_length_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_SIZE *length); + uint32_t number, PCRE2_SIZE *length); int pcre2_substring_copy_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR *buffer, + uint32_t number, PCRE2_UCHAR *buffer, PCRE2_SIZE *bufflen); int pcre2_substring_get_bynumber(pcre2_match_data *match_data, - unsigned int number, PCRE2_UCHAR **bufferptr, + uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen); void pcre2_substring_free(PCRE2_UCHAR *buffer); @@ -2624,7 +2624,7 @@ AUTHOR REVISION - Last updated: 27 November 2014 + Last updated: 01 December 2014 Copyright (c) 1997-2014 University of Cambridge. ------------------------------------------------------------------------------ diff --git a/doc/pcre2_pattern_info.3 b/doc/pcre2_pattern_info.3 index 072e0bd..8424e6f 100644 --- a/doc/pcre2_pattern_info.3 +++ b/doc/pcre2_pattern_info.3 @@ -1,4 +1,4 @@ -.TH PCRE2_PATTERN_INFO 3 "21 October 2014" "PCRE2 10.00" +.TH PCRE2_PATTERN_INFO 3 "01 December 2014" "PCRE2 10.00" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH SYNOPSIS @@ -15,19 +15,19 @@ PCRE2 - Perl-compatible regular expressions (revised API) .sp This function returns information about a compiled pattern. Its arguments are: .sp - \fIcode\fP Compiled regular expression - \fIwhat\fP What information is required - \fIwhere\fP Where to put the information + \fIcode\fP Pointer to a compiled regular expression + \fIwhat\fP What information is required + \fIwhere\fP Where to put the information .sp -If \fIwhere\fP is NULL, the function returns the amount of memory needed for -the requested information, in bytes. The following information is available: +The recognized values for the \fIwhat\fP argument, and the information they +request are as follows: .sp PCRE2_INFO_ALLOPTIONS Final options after compiling PCRE2_INFO_ARGOPTIONS Options passed to \fBpcre2_compile()\fP PCRE2_INFO_BACKREFMAX Number of highest back reference - PCRE2_INFO_BSR What \eR matches - 0 all Unicode line endings - 1 CR, LF, or CRLF only + PCRE2_INFO_BSR What \eR matches: + PCRE2_BSR_UNICODE: Unicode line endings + PCRE2_BSR_ANYCRLF: CR, LF, or CRLF only PCRE2_INFO_CAPTURECOUNT Number of capturing subpatterns PCRE2_INFO_FIRSTBITMAP Bitmap of first code units, or NULL PCRE2_INFO_FIRSTCODEUNIT First code unit when type is 1 @@ -46,7 +46,7 @@ the requested information, in bytes. The following information is available: PCRE2_INFO_MATCHEMPTY 1 if the pattern can match an empty string, 0 otherwise PCRE2_INFO_MATCHLIMIT Match limit if set, - otherwise PCRE2_RROR_UNSET + otherwise PCRE2_ERROR_UNSET PCRE2_INFO_MAXLOOKBEHIND Length (in characters) of the longest lookbehind assertion PCRE2_INFO_MINLENGTH Lower bound length of matching strings @@ -54,17 +54,20 @@ the requested information, in bytes. The following information is available: PCRE2_INFO_NAMECOUNT Number of named subpatterns PCRE2_INFO_NAMETABLE Pointer to name table PCRE2_CONFIG_NEWLINE Code for the newline sequence: - 1 for CR - 2 for LF - 3 for CRLF - 4 for ANY - 5 for ANYCRLF + PCRE2_NEWLINE_CR + PCRE2_NEWLINE_LF + PCRE2_NEWLINE_CRLF + PCRE2_NEWLINE_ANY + PCRE2_NEWLINE_ANYCRLF PCRE2_INFO_RECURSIONLIMIT Recursion limit if set, otherwise PCRE2_ERROR_UNSET PCRE2_INFO_SIZE Size of compiled pattern .sp -The \fIwhere\fP argument must point to an unsigned 32-bit integer (uint32_t -variable), except for the following \fIwhat\fP values: +If \fIwhere\fP is NULL, the function returns the amount of memory needed for +the requested information, in bytes. Otherwise, the \fIwhere\fP argument must +point to an unsigned 32-bit integer (uint32_t variable), except for the +following \fIwhat\fP values, when it must point to a variable of the type +shown: .sp PCRE2_INFO_FIRSTBITMAP const uint8_t * PCRE2_INFO_JITSIZE size_t diff --git a/doc/pcre2_substring_copy_bynumber.3 b/doc/pcre2_substring_copy_bynumber.3 index 5b4a262..cb8397c 100644 --- a/doc/pcre2_substring_copy_bynumber.3 +++ b/doc/pcre2_substring_copy_bynumber.3 @@ -1,4 +1,4 @@ -.TH PCRE2_SUBSTRING_COPY_BYNUMBER 3 "21 October 2014" "PCRE2 10.00" +.TH PCRE2_SUBSTRING_COPY_BYNUMBER 3 "01 December 2014" "PCRE2 10.00" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH SYNOPSIS @@ -8,7 +8,7 @@ PCRE2 - Perl-compatible regular expressions (revised API) .PP .nf .B int pcre2_substring_copy_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP," +.B " uint32_t \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP," .B " PCRE2_SIZE *\fIbufflen\fP);" .fi . diff --git a/doc/pcre2_substring_get_bynumber.3 b/doc/pcre2_substring_get_bynumber.3 index ca65013..0703e04 100644 --- a/doc/pcre2_substring_get_bynumber.3 +++ b/doc/pcre2_substring_get_bynumber.3 @@ -1,4 +1,4 @@ -.TH PCRE2_SUBSTRING_GET_BYNUMBER 3 "21 October 2014" "PCRE2 10.00" +.TH PCRE2_SUBSTRING_GET_BYNUMBER 3 "01 December 2014" "PCRE2 10.00" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH SYNOPSIS @@ -8,14 +8,14 @@ PCRE2 - Perl-compatible regular expressions (revised API) .PP .nf .B int pcre2_substring_get_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP, PCRE2_SIZE *\fIbufflen\fP);" +.B " uint32_t \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP, PCRE2_SIZE *\fIbufflen\fP);" .fi . .SH DESCRIPTION .rs .sp -This is a convenience function for extracting a captured substring by number into -newly acquired memory. The arguments are: +This is a convenience function for extracting a captured substring by number +into newly acquired memory. The arguments are: .sp \fImatch_data\fP The match data for the match \fInumber\fP Number of the required substring diff --git a/doc/pcre2_substring_length_bynumber.3 b/doc/pcre2_substring_length_bynumber.3 index 5035a35..c625fc7 100644 --- a/doc/pcre2_substring_length_bynumber.3 +++ b/doc/pcre2_substring_length_bynumber.3 @@ -1,4 +1,4 @@ -.TH PCRE2_SUBSTRING_LENGTH_BYNUMBER 3 "21 October 2014" "PCRE2 10.00" +.TH PCRE2_SUBSTRING_LENGTH_BYNUMBER 3 "01 December 2014" "PCRE2 10.00" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .SH SYNOPSIS @@ -8,7 +8,7 @@ PCRE2 - Perl-compatible regular expressions (revised API) .PP .nf .B int pcre2_substring_length_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_SIZE *\fIlength\fP);" +.B " uint32_t \fInumber\fP, PCRE2_SIZE *\fIlength\fP);" .fi . .SH DESCRIPTION diff --git a/doc/pcre2api.3 b/doc/pcre2api.3 index b0cfc77..3271928 100644 --- a/doc/pcre2api.3 +++ b/doc/pcre2api.3 @@ -1,4 +1,4 @@ -.TH PCRE2API 3 "27 November 2014" "PCRE2 10.00" +.TH PCRE2API 3 "01 December 2014" "PCRE2 10.00" .SH NAME PCRE2 - Perl-compatible regular expressions (revised API) .sp @@ -138,7 +138,7 @@ document for an overview of all the PCRE2 documentation. .B " PCRE2_SPTR \fIname\fP, PCRE2_UCHAR *\fIbuffer\fP, PCRE2_SIZE *\fIbufflen\fP);" .sp .B int pcre2_substring_copy_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP," +.B " uint32_t \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP," .B " PCRE2_SIZE *\fIbufflen\fP);" .sp .B void pcre2_substring_free(PCRE2_UCHAR *\fIbuffer\fP); @@ -147,14 +147,14 @@ document for an overview of all the PCRE2 documentation. .B " PCRE2_SPTR \fIname\fP, PCRE2_UCHAR **\fIbufferptr\fP, PCRE2_SIZE *\fIbufflen\fP);" .sp .B int pcre2_substring_get_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP," +.B " uint32_t \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP," .B " PCRE2_SIZE *\fIbufflen\fP);" .sp .B int pcre2_substring_length_byname(pcre2_match_data *\fImatch_data\fP, .B " PCRE2_SPTR \fIname\fP, PCRE2_SIZE *\fIlength\fP);" .sp .B int pcre2_substring_length_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_SIZE *\fIlength\fP);" +.B " uint32_t \fInumber\fP, PCRE2_SIZE *\fIlength\fP);" .sp .B int pcre2_substring_nametable_scan(const pcre2_code *\fIcode\fP, .B " PCRE2_SPTR \fIname\fP, PCRE2_SPTR *\fIfirst\fP, PCRE2_SPTR *\fIlast\fP);" @@ -2248,14 +2248,14 @@ The internal recursion limit was reached. .sp .nf .B int pcre2_substring_length_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_SIZE *\fIlength\fP);" +.B " uint32_t \fInumber\fP, PCRE2_SIZE *\fIlength\fP);" .sp .B int pcre2_substring_copy_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP," +.B " uint32_t \fInumber\fP, PCRE2_UCHAR *\fIbuffer\fP," .B " PCRE2_SIZE *\fIbufflen\fP);" .sp .B int pcre2_substring_get_bynumber(pcre2_match_data *\fImatch_data\fP, -.B " unsigned int \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP," +.B " uint32_t \fInumber\fP, PCRE2_UCHAR **\fIbufferptr\fP," .B " PCRE2_SIZE *\fIbufflen\fP);" .sp .B void pcre2_substring_free(PCRE2_UCHAR *\fIbuffer\fP); @@ -2735,6 +2735,6 @@ Cambridge, England. .rs .sp .nf -Last updated: 27 November 2014 +Last updated: 01 December 2014 Copyright (c) 1997-2014 University of Cambridge. .fi diff --git a/src/pcre2.h.in b/src/pcre2.h.in index f8d4f3f..ee609a1 100644 --- a/src/pcre2.h.in +++ b/src/pcre2.h.in @@ -434,16 +434,16 @@ PCRE2_EXP_DECL PCRE2_SIZE pcre2_get_startchar(pcre2_match_data *); PCRE2_EXP_DECL int pcre2_substring_copy_byname(pcre2_match_data *, \ PCRE2_SPTR, PCRE2_UCHAR *, PCRE2_SIZE *); \ PCRE2_EXP_DECL int pcre2_substring_copy_bynumber(pcre2_match_data *, \ - unsigned int, PCRE2_UCHAR *, PCRE2_SIZE *); \ + uint32_t, 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_SIZE *); \ PCRE2_EXP_DECL int pcre2_substring_get_bynumber(pcre2_match_data *, \ - unsigned int, PCRE2_UCHAR **, PCRE2_SIZE *); \ + uint32_t, PCRE2_UCHAR **, PCRE2_SIZE *); \ PCRE2_EXP_DECL int pcre2_substring_length_byname(pcre2_match_data *, \ PCRE2_SPTR, PCRE2_SIZE *); \ PCRE2_EXP_DECL int pcre2_substring_length_bynumber(pcre2_match_data *, \ - unsigned int, PCRE2_SIZE *); \ + uint32_t, 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(\ diff --git a/src/pcre2_context.c b/src/pcre2_context.c index 1fe3d4c..6146999 100644 --- a/src/pcre2_context.c +++ b/src/pcre2_context.c @@ -82,7 +82,7 @@ Arguments: Returns: pointer to memory or NULL on failure */ -PCRE2_EXP_DEFN void * +extern void * PRIV(memctl_malloc)(size_t size, pcre2_memctl *memctl) { pcre2_memctl *newmemctl; diff --git a/src/pcre2_internal.h b/src/pcre2_internal.h index 8f541dd..e174195 100644 --- a/src/pcre2_internal.h +++ b/src/pcre2_internal.h @@ -75,38 +75,30 @@ using some MS magic. I found some useful information on this web page: http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the information there, using __declspec(dllexport) without "extern" we have a definition; with "extern" we have a declaration. The settings here override the -setting in pcre.h (which is included below); it defines only PCRE2_EXP_DECL, +setting in pcre2.h (which is included below); it defines only PCRE2_EXP_DECL, which is all that is needed for applications (they just import the symbols). We use: - PCRE2_EXP_DECL for declarations - PCRE2_EXP_DEFN for definitions of exported functions - PCRE2_EXP_DATA_DEFN for definitions of exported variables + PCRE2_EXP_DECL for declarations + PCRE2_EXP_DEFN for definitions -The reason for the two DEFN macros is that in non-Windows environments, one -does not want to have "extern" before variable definitions because it leads to -compiler warnings. So we distinguish between functions and variables. In -Windows, the two should always be the same. - -The reason for wrapping this in #ifndef PCRE2_EXP_DECL is so that pcretest, +The reason for wrapping this in #ifndef PCRE2_EXP_DECL is so that pcre2test, which is an application, but needs to import this file in order to "peek" at -internals, can #include pcre.h first to get an application's-eye view. +internals, can #include pcre2.h first to get an application's-eye view. In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon, special-purpose environments) might want to stick other stuff in front of -exported symbols. That's why, in the non-Windows case, we set PCRE2_EXP_DEFN and -PCRE2_EXP_DATA_DEFN only if they are not already set. */ +exported symbols. That's why, in the non-Windows case, we set PCRE2_EXP_DEFN +only if it is not already set. */ #ifndef PCRE2_EXP_DECL # ifdef _WIN32 # ifndef PCRE2_STATIC # define PCRE2_EXP_DECL extern __declspec(dllexport) # define PCRE2_EXP_DEFN __declspec(dllexport) -# define PCRE2_EXP_DATA_DEFN __declspec(dllexport) # else # define PCRE2_EXP_DECL extern # define PCRE2_EXP_DEFN -# define PCRE2_EXP_DATA_DEFN # endif # else # ifdef __cplusplus @@ -117,9 +109,6 @@ PCRE2_EXP_DATA_DEFN only if they are not already set. */ # ifndef PCRE2_EXP_DEFN # define PCRE2_EXP_DEFN PCRE2_EXP_DECL # endif -# ifndef PCRE2_EXP_DATA_DEFN -# define PCRE2_EXP_DATA_DEFN -# endif # endif #endif @@ -129,7 +118,7 @@ property values. This must follow the setting of PCRE2_EXP_DECL above. */ #include "pcre2.h" #include "pcre2_ucp.h" -/* When PCRE is compiled as a C++ library, the subject pointer can be replaced +/* When PCRE2 is compiled as a C++ library, the subject pointer can be replaced with a custom type. This makes it possible, for example, to allow pcre2_match() to process subject strings that are discontinuous by using a smart pointer class. It must always be possible to inspect all of the subject string in diff --git a/src/pcre2_substring.c b/src/pcre2_substring.c index 92adbac..d0826ff 100644 --- a/src/pcre2_substring.c +++ b/src/pcre2_substring.c @@ -79,7 +79,7 @@ int entrysize = pcre2_substring_nametable_scan(match_data->code, stringname, if (entrysize < 0) return entrysize; for (entry = first; entry <= last; entry += entrysize) { - uint16_t n = GET2(entry, 0); + uint32_t n = GET2(entry, 0); if (n < match_data->oveccount && match_data->ovector[n*2] != PCRE2_UNSET) return pcre2_substring_copy_bynumber(match_data, n, buffer, sizeptr); } @@ -109,7 +109,7 @@ Returns: if successful: 0 PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION pcre2_substring_copy_bynumber(pcre2_match_data *match_data, - unsigned int stringnumber, PCRE2_UCHAR *buffer, PCRE2_SIZE *sizeptr) + uint32_t stringnumber, PCRE2_UCHAR *buffer, PCRE2_SIZE *sizeptr) { PCRE2_SIZE left, right; PCRE2_SIZE p = 0; @@ -160,7 +160,7 @@ int entrysize = pcre2_substring_nametable_scan(match_data->code, stringname, if (entrysize < 0) return entrysize; for (entry = first; entry <= last; entry += entrysize) { - uint16_t n = GET2(entry, 0); + uint32_t n = GET2(entry, 0); if (n < match_data->oveccount && match_data->ovector[n*2] != PCRE2_UNSET) return pcre2_substring_get_bynumber(match_data, n, stringptr, sizeptr); } @@ -190,7 +190,7 @@ Returns: if successful: zero PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION pcre2_substring_get_bynumber(pcre2_match_data *match_data, - unsigned int stringnumber, PCRE2_UCHAR **stringptr, PCRE2_SIZE *sizeptr) + uint32_t stringnumber, PCRE2_UCHAR **stringptr, PCRE2_SIZE *sizeptr) { PCRE2_SIZE left, right; PCRE2_SIZE p = 0; @@ -263,7 +263,7 @@ int entrysize = pcre2_substring_nametable_scan(match_data->code, stringname, if (entrysize <= 0) return entrysize; for (entry = first; entry <= last; entry += entrysize) { - uint16_t n = GET2(entry, 0); + uint32_t n = GET2(entry, 0); if (n < match_data->oveccount && match_data->ovector[n*2] != PCRE2_UNSET) return pcre2_substring_length_bynumber(match_data, n, sizeptr); } @@ -288,7 +288,7 @@ Returns: 0 if successful, else a negative error number PCRE2_EXP_DEFN int PCRE2_CALL_CONVENTION pcre2_substring_length_bynumber(pcre2_match_data *match_data, - unsigned int stringnumber, PCRE2_SIZE *sizeptr) + uint32_t stringnumber, PCRE2_SIZE *sizeptr) { if (stringnumber >= match_data->oveccount || stringnumber > match_data->code->top_bracket ||