diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-19 13:06:21 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2019-03-19 13:06:21 +0100 |
commit | 4fe3d108af2b0a1e8810959fe1ea7a0b52291ad7 (patch) | |
tree | c6325dd574d98e6fa37987af558e08f5b932fe4b /ext/mysqlnd/mysqlnd_commands.c | |
parent | 38b16274d16f3a90dd42e340b8429041c6aa7365 (diff) | |
download | php-git-4fe3d108af2b0a1e8810959fe1ea7a0b52291ad7.tar.gz |
Don't create a new array for empty/null match every time
If PREG_OFFSET_CAPTURE is used, unmatched subpatterns will be either
[null, -1] or ['', -1] depending on PREG_UNMATCHED_AS_NULL mode.
Instead of creating a new array like this every time, cache it inside
a global (per-request -- could make it immutable though).
Additionally check whether the subpattern is an empty string or
single character string and use an existing interned string in that
case. Empty / single-char subpatterns are common, so let's avoid
allocating strings for them.
Diffstat (limited to 'ext/mysqlnd/mysqlnd_commands.c')
0 files changed, 0 insertions, 0 deletions