[RFC] Add grapheme_strrev function#20949
Conversation
Add more tests Arabic for grapheme_strrev function.
b61bac2 to
80e6b92
Compare
|
This RFC is accepted, So ready for review. |
|
There's no rush, Does anyone review this? |
| p = ZSTR_VAL(ret); | ||
|
|
||
| ubrk_setUText(bi, ut, &ustatus); | ||
| pos = ubrk_last(bi); |
There was a problem hiding this comment.
nit: might be worth check in case pos == UBRK_DONE is to "jump to conclusion" to bypass the loop below wdyt ?
There was a problem hiding this comment.
Indeed, I added RETVAL_EMPTY_STRING.
There was a problem hiding this comment.
just one detail, do not forget you allocate ret pointer line 1172.
There was a problem hiding this comment.
it might just simpler to raise the goto label at the 1190 line instead
There was a problem hiding this comment.
I tried add ubrk_end in RETVAL_NEW_STR .
| ubrk_setUText(bi, ut, &ustatus); | ||
| pos = ubrk_last(bi); | ||
| if (pos == UBRK_DONE) { | ||
| RETVAL_EMPTY_STRING(); |
There was a problem hiding this comment.
but then this line looks useless wdyt ?
There was a problem hiding this comment.
Indeed, I remove RETVAL_EMPTY_STRING.
|
Thank you, I'll merge tomorrow(maybe 9am JST) if there is no concern. |
|
Thank you very much. Merged. |
| ubrk_setUText(bi, ut, &ustatus); | ||
| pos = ubrk_last(bi); | ||
| if (pos == UBRK_DONE) { | ||
| goto ubrk_end; |
There was a problem hiding this comment.
If this code path is taken, then the return value isn't set correctly I think?
If this code path is taken, is the string NUL terminated? It seems not?
There was a problem hiding this comment.
Oh, Indeed. So I use RETVAL_EMPTY_STRING() in line 1178 right?
There was a problem hiding this comment.
I suppose the empty string should be returned and the string allocation should be postponed to after this is.
Looking further at this: I don't immediately understand what code writes the NUL terminator for the loop below?
Add grapheme_strrev function.
strrevfor grapheme cluster unit.RFC: https://wiki.php.net/rfc/grapheme_strrev