Re: Algorithmic efficiency of zend_memrchr

php.internals

Benjamin Coutu

9 years ago
The type qualifier is just copy paste relic. We'd of course have to remove const form the signature (and the function body) for this to work. Quickly looking at zend_memrchr's call sites I don't see that it would be a huge issue to modify that or am I missing something? ========== Original ========== From: Levi Morrison <levim@php.net> To: Benjamin Coutu <ben.coutu@zeyos.com> Date: Thu, 03 Nov 2016 13:23:23 +0100 Subject: Re: [PHP-DEV] Algorithmic efficiency of zend_memrchr >

Nikita Popov

9 years ago
On Thu, Nov 3, 2016 at 2:33 PM, Benjamin Coutu <ben.coutu@zeyos.com> wrote:
> The type qualifier is just copy paste relic. We'd of course have to remove > const form the signature (and the function body) for this to work. Quickly > looking at zend_memrchr's call sites I don't see that it would be a huge > issue to modify that or am I missing something? >
A lot of our strings are interned and live in SHM. Modifying them would cause memory corruption and race conditions. Just consider two memrchr operations on different characters operating on the same string in two different PHP processes. Nikita