Although passing a null pointer to pcre16_get_stringnumber for
the compiled pattern should simply make it error out, it's actually
an undocumented behaviour, so let's stay safe and add an explicit
check.
Tests for this codepath are added.
Change-Id: Ifd9c87874f6812ba487104ec1a5bbc83c3b16761
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
PCRE's JIT uses by default 32K on the pcre_exec caller's stack. This
is fine for most situations, but in some cases (esp. patterns with
lot of recursion) more memory is required.
Therefore, if a match execution fails due to exhausting JIT memory,
we let PCRE allocate up to 512KB to be used for the JIT's stack.
The pointer to the allocated memory is put in thread local storage
(so it can be reused from the same thread, if needed, and automatically
goes away when the thread dies).
Change-Id: Ica5fb7d517068befff88ebb198a603a26ec5d8a7
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Exporting the counter that controls the optimization of a compiled
pattern lets us to forcibly optimize all patterns. Therefore,
two tests are now run: one with default optimization values
and another one which always optimizes the pattern.
The counter itself was renamed with a qt_ prefix and put
inside the Qt compilation namespace
(thanks to rohanpm for pointing it out).
Change-Id: I56602433d37adc127772b2d0d2cdaf2e49d43c71
Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Some minor fixes: obviously, a valid match always come from a
valid regular expression, but a valid regular expression can create
an invalid match (internal error during matching).
Also, testing an invalid iterator should silence the emitted
warnings.
Change-Id: I585bb99a81e22f108601fd66bf30b56e0229d68b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
QRegularExpression::captureCount() returns the number of
capturing groups inside the regular expression pattern.
Change-Id: Ib90ce67c67d06ab2966f0c98bd91da21defc156d
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Trivial change: compare dpointers first, then the data.
Added test function for operator==.
Change-Id: I33ac64a59db4ccad56c30be17622187e42415f38
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Added QRegularExpression, QRegularExpressionMatch and
QRegularExpressionMatchIterator as PCRE-enabled, regexp classes.
Documentation is included, as well as a first round of autotests.
Task-number: QTBUG-23489
Change-Id: Id47031b80602c913ccd2fd740070e3024ea06abc
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>