Skip to content

Commit

Permalink
doc: document that the POSIX interface is not POSIX compatible
Browse files Browse the repository at this point in the history
POSIX 1003.1-2008 requires that regoff_t be at least as large as
ssize_t or ptrdiff_t, but we use int and therefore any match is
restricted to what that can hold, even in 64-bit architectures.
  • Loading branch information
carenas committed Nov 16, 2023
1 parent bbd0fba commit 778678b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions doc/pcre2posix.3
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ documentation for a description of PCRE2's native API, which contains much
additional functionality.
.P
\fBIMPORTANT NOTE\fP: The functions described here are NOT thread-safe, and
should not be used in multi-threaded applications. Use the native API instead.
should not be used in multi-threaded applications. They are also limited to
processing subjects that are not bigger than 2GB. Use the native API instead.
.P
These functions are wrapper functions that ultimately call the PCRE2 native
API. Their prototypes are defined in the \fBpcre2posix.h\fP header file, and
Expand Down Expand Up @@ -74,7 +75,7 @@ captured substrings. It also defines some constants whose names start with
.sp
Note that these functions are just POSIX-style wrappers for PCRE2's native API.
They do not give POSIX regular expression behaviour, and they are not
thread-safe.
thread-safe or even POSIX compatible.
.P
Those POSIX option bits that can reasonably be mapped to PCRE2 native options
have been implemented. In addition, the option REG_EXTENDED is defined with the
Expand Down Expand Up @@ -298,6 +299,10 @@ entire portion of \fIstring\fP that was matched; subsequent elements relate to
the capturing subpatterns of the regular expression. Unused entries in the
array have both structure members set to -1.
.P
\fIregmatch_t\fP as well as the \fIregoff_t\fP typedef it uses are defined in
\fBpcre2posix.h\fP and are not warranted to have the same size or layout as other
similarly named types from other libraries that provide POSIX-style matching.
.P
A successful match yields a zero return; various error codes are defined in the
header file, of which REG_NOMATCH is the "expected" failure code.
.
Expand Down

0 comments on commit 778678b

Please sign in to comment.