[Pcre-svn] [1134] code/trunk: Implemented pcre2_get_match_d…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1134] code/trunk: Implemented pcre2_get_match_data_size().
Revision: 1134
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1134
Author:   ph10
Date:     2019-07-16 16:50:09 +0100 (Tue, 16 Jul 2019)
Log Message:
-----------
Implemented pcre2_get_match_data_size().


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/Makefile.am
    code/trunk/doc/html/index.html
    code/trunk/doc/index.html.src
    code/trunk/src/pcre2.h.in
    code/trunk/src/pcre2_match_data.c
    code/trunk/src/pcre2test.c


Added Paths:
-----------
    code/trunk/doc/html/pcre2_get_match_data_size.html
    code/trunk/doc/pcre2_get_match_data_size.3


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/ChangeLog    2019-07-16 15:50:09 UTC (rev 1134)
@@ -88,7 +88,7 @@
 17. Check for integer overflow when computing lookbehind lengths. Fixes 
 Clusterfuzz issue 15636.


-18. Implement non-atomic positive lookaround assertions.
+18. Implemented non-atomic positive lookaround assertions.

19. If a lookbehind contained a lookahead that contained another lookbehind
within it, the nested lookbehind was not correctly processed. For example, if
@@ -95,7 +95,9 @@
/(?<=(?=(?<=a)))b/ was matched to "ab" it gave no match instead of matching
"b".

+20. Implemented pcre2_get_match_data_size().

+
Version 10.33 16-April-2019
---------------------------


Modified: code/trunk/Makefile.am
===================================================================
--- code/trunk/Makefile.am    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/Makefile.am    2019-07-16 15:50:09 UTC (rev 1134)
@@ -46,6 +46,7 @@
   doc/html/pcre2_general_context_free.html \
   doc/html/pcre2_get_error_message.html \
   doc/html/pcre2_get_mark.html \
+  doc/html/pcre2_get_match_data_size.html \
   doc/html/pcre2_get_ovector_count.html \
   doc/html/pcre2_get_ovector_pointer.html \
   doc/html/pcre2_get_startchar.html \
@@ -140,6 +141,7 @@
   doc/pcre2_general_context_free.3 \
   doc/pcre2_get_error_message.3 \
   doc/pcre2_get_mark.3 \
+  doc/pcre2_get_match_data_size.3 \
   doc/pcre2_get_ovector_count.3 \
   doc/pcre2_get_ovector_pointer.3 \
   doc/pcre2_get_startchar.3 \


Modified: code/trunk/doc/html/index.html
===================================================================
--- code/trunk/doc/html/index.html    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/doc/html/index.html    2019-07-16 15:50:09 UTC (rev 1134)
@@ -146,6 +146,9 @@
 <tr><td><a href="pcre2_get_mark.html">pcre2_get_mark</a></td>
     <td>&nbsp;&nbsp;Get a (*MARK) name</td></tr>


+<tr><td><a href="pcre2_get_match_data_size.html">pcre2_get_match_data_size</a></td>
+    <td>&nbsp;&nbsp;Get the size of a match data block</td></tr>
+
 <tr><td><a href="pcre2_get_ovector_count.html">pcre2_get_ovector_count</a></td>
     <td>&nbsp;&nbsp;Get the ovector count</td></tr>



Added: code/trunk/doc/html/pcre2_get_match_data_size.html
===================================================================
--- code/trunk/doc/html/pcre2_get_match_data_size.html                            (rev 0)
+++ code/trunk/doc/html/pcre2_get_match_data_size.html    2019-07-16 15:50:09 UTC (rev 1134)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<title>pcre2_get_match_data_size specification</title>
+</head>
+<body bgcolor="#FFFFFF" text="#00005A" link="#0066FF" alink="#3399FF" vlink="#2222BB">
+<h1>pcre2_get_match_data_size man page</h1>
+<p>
+Return to the <a href="index.html">PCRE2 index page</a>.
+</p>
+<p>
+This page is part of the PCRE2 HTML documentation. It was generated
+automatically from the original man page. If there is any nonsense in it,
+please consult the man page, in case the conversion went wrong.
+<br>
+<br><b>
+SYNOPSIS
+</b><br>
+<P>
+<b>#include &#60;pcre2.h&#62;</b>
+</P>
+<P>
+<b>PCRE2_SIZE pcre2_get_match_data_size(pcre2_match_data *<i>match_data</i>);</b>
+</P>
+<br><b>
+DESCRIPTION
+</b><br>
+<P>
+This function returns the size, in bytes, of the match data block that is its 
+argument.
+</P>
+<P>
+There is a complete description of the PCRE2 native API in the
+<a href="pcre2api.html"><b>pcre2api</b></a>
+page and a description of the POSIX API in the
+<a href="pcre2posix.html"><b>pcre2posix</b></a>
+page.
+<p>
+Return to the <a href="index.html">PCRE2 index page</a>.
+</p>


Modified: code/trunk/doc/index.html.src
===================================================================
--- code/trunk/doc/index.html.src    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/doc/index.html.src    2019-07-16 15:50:09 UTC (rev 1134)
@@ -146,6 +146,9 @@
 <tr><td><a href="pcre2_get_mark.html">pcre2_get_mark</a></td>
     <td>&nbsp;&nbsp;Get a (*MARK) name</td></tr>


+<tr><td><a href="pcre2_get_match_data_size.html">pcre2_get_match_data_size</a></td>
+    <td>&nbsp;&nbsp;Get the size of a match data block</td></tr>
+
 <tr><td><a href="pcre2_get_ovector_count.html">pcre2_get_ovector_count</a></td>
     <td>&nbsp;&nbsp;Get the ovector count</td></tr>



Added: code/trunk/doc/pcre2_get_match_data_size.3
===================================================================
--- code/trunk/doc/pcre2_get_match_data_size.3                            (rev 0)
+++ code/trunk/doc/pcre2_get_match_data_size.3    2019-07-16 15:50:09 UTC (rev 1134)
@@ -0,0 +1,27 @@
+.TH PCRE2_GET_MATCH_DATA_SIZE 3 "16 July 2019" "PCRE2 10.34"
+.SH NAME
+PCRE2 - Perl-compatible regular expressions (revised API)
+.SH SYNOPSIS
+.rs
+.sp
+.B #include <pcre2.h>
+.PP
+.nf
+.B PCRE2_SIZE pcre2_get_match_data_size(pcre2_match_data *\fImatch_data\fP);
+.fi
+.
+.SH DESCRIPTION
+.rs
+.sp
+This function returns the size, in bytes, of the match data block that is its 
+argument.
+.P
+There is a complete description of the PCRE2 native API in the
+.\" HREF
+\fBpcre2api\fP
+.\"
+page and a description of the POSIX API in the
+.\" HREF
+\fBpcre2posix\fP
+.\"
+page.


Modified: code/trunk/src/pcre2.h.in
===================================================================
--- code/trunk/src/pcre2.h.in    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/src/pcre2.h.in    2019-07-16 15:50:09 UTC (rev 1134)
@@ -679,6 +679,8 @@
   pcre2_match_data_free(pcre2_match_data *); \
 PCRE2_EXP_DECL PCRE2_SPTR PCRE2_CALL_CONVENTION \
   pcre2_get_mark(pcre2_match_data *); \
+PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
+  pcre2_get_match_data_size(pcre2_match_data *); \
 PCRE2_EXP_DECL uint32_t PCRE2_CALL_CONVENTION \
   pcre2_get_ovector_count(pcre2_match_data *); \
 PCRE2_EXP_DECL PCRE2_SIZE PCRE2_CALL_CONVENTION \
@@ -842,6 +844,7 @@
 #define pcre2_general_context_free            PCRE2_SUFFIX(pcre2_general_context_free_)
 #define pcre2_get_error_message               PCRE2_SUFFIX(pcre2_get_error_message_)
 #define pcre2_get_mark                        PCRE2_SUFFIX(pcre2_get_mark_)
+#define pcre2_get_match_data_size             PCRE2_SUFFIX(pcre2_get_match_data_size_)
 #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_startchar                   PCRE2_SUFFIX(pcre2_get_startchar_)


Modified: code/trunk/src/pcre2_match_data.c
===================================================================
--- code/trunk/src/pcre2_match_data.c    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/src/pcre2_match_data.c    2019-07-16 15:50:09 UTC (rev 1134)
@@ -7,7 +7,7 @@


                        Written by Philip Hazel
      Original API code Copyright (c) 1997-2012 University of Cambridge
-          New API code Copyright (c) 2016-2018 University of Cambridge
+          New API code Copyright (c) 2016-2019 University of Cambridge


-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
@@ -150,4 +150,17 @@
return match_data->startchar;
}

+
+
+/*************************************************
+*         Get size of match data block           *
+*************************************************/
+
+PCRE2_EXP_DEFN PCRE2_SIZE PCRE2_CALL_CONVENTION
+pcre2_get_match_data_size(pcre2_match_data *match_data)
+{
+return offsetof(pcre2_match_data, ovector) +
+  2 * (match_data->oveccount) * sizeof(PCRE2_SIZE);
+}
+
 /* End of pcre2_match_data.c */


Modified: code/trunk/src/pcre2test.c
===================================================================
--- code/trunk/src/pcre2test.c    2019-07-16 15:06:21 UTC (rev 1133)
+++ code/trunk/src/pcre2test.c    2019-07-16 15:50:09 UTC (rev 1134)
@@ -3269,7 +3269,7 @@




-/* This function is no longer used. Keep it around for a while, just in case it
+/* This function is no longer used. Keep it around for a while, just in case it
needs to be re-instated. */

 #ifdef NEVERNEVERNEVER
@@ -8662,7 +8662,7 @@
         {
         fprintf(stderr, "** Argument for %s must not be zero\n", arg);
         exit(1);
-        }    
+        }
       if (U32OVERFLOW(uli))
         {
         fprintf(stderr, "** Argument for %s is too big\n", arg);
@@ -8820,8 +8820,8 @@
   }  /* End of -error handling */


/* Initialize things that cannot be done until we know which test mode we are
-running in. Exercise the general context copying function, which is not
-otherwise used. */
+running in. Exercise the general context copying and match data size functions,
+which are not otherwise used. */

code_unit_size = test_mode/8;
max_oveccount = DEFAULT_OVECCOUNT;
@@ -8843,8 +8843,10 @@
(void)G(pcre2_set_compile_extra_options_,BITS)(G(pat_context,BITS), 0); \
(void)G(pcre2_set_max_pattern_length_,BITS)(G(pat_context,BITS), 0); \
(void)G(pcre2_set_offset_limit_,BITS)(G(dat_context,BITS), 0); \
- (void)G(pcre2_set_recursion_memory_management_,BITS)(G(dat_context,BITS), my_malloc, my_free, NULL)
+ (void)G(pcre2_set_recursion_memory_management_,BITS)(G(dat_context,BITS), my_malloc, my_free, NULL); \
+ (void)G(pcre2_get_match_data_size_,BITS)(G(match_data,BITS))

+
/* Call the appropriate functions for the current mode, and exercise some
functions that are not otherwise called. */