RE: [PHP-DEV] RE: Improved zend_string API
| From: | François Laupretre | Date: | Tue, 30 Jun 2015 02:52:24 +0000 |
| Subject: | RE: [PHP-DEV] RE: Improved zend_string API | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-86955@lists.php.net to get a copy of this message | ||
Hi,
> De : François Laupretre [mailto:francois@php.net]
> Envoyé : mardi 30 juin 2015 03:08
> À : 'Dmitry Stogov'
> Cc : 'Anatol Belski'; 'PHP Internals'
> Objet : [PHP-DEV] RE: Improved zend_string API
>
> Hi Dmitry,
>
> I just commited some additional changes, following your suggestions :
>
> - Renamed every ‘zend_string_xxx()’ functions to ‘ZSTR_’-prefixed
> uppercase names,
> - Defined compatibility macros for old names
> - Changed the rest of the code to use new ZSTR_ names
> - A special case for zend_string_tolower(), which I found in
> ‘zend_operators.c’. I renamed it but didn’t move it to zend_string.c/.h. You
> probably know better than me if there’s a good reason to define it there or if
> it should be moved.
>
> I also made ZSTR_LEN() read-only (ZSTR_SET_LEN() must be used for write
> operations), making the zend_string API ‘clean’ in terms of separate
> getters/setters (Z_STRLEN() remains a read-write macro, no BC break here).
>
> I removed the functions you removed. Anyway, increment/decrement
> functions will need to be defined when we migrate the code to use the API
> only because the code often increments/decrements string length. As
> ZSTR_LEN() is read-only, we cannot use ‘++’ with it, and providing
> increment/decrement functions at the zend_string level is the only way to
> avoid writing ‘ZSTR_SET_LEN(s,ZSTR_LEN(s) + 1)’.
>
> I hope we (and especially you) still have enough time to integrate this,
> especially the new ‘ZSTR’ naming scheme. Anyway, I’m glad you could
> commit the most important additions for 7.0.
I hadn't noticed that the PR had been closed.
The changes described in my previous message are now at : https://github.com/php/php-src/pull/1381
Regards
François