develooper Front page | perl.perl5.porters | Postings from June 2022

Re: Pre-RFC: New C API for converting from UTF-8 to code point

Thread Previous | Thread Next
From:
hv
Date:
June 29, 2022 02:45
Subject:
Re: Pre-RFC: New C API for converting from UTF-8 to code point
Message ID:
202206290227.25T2RuP13005@crypt.org
Karl Williamson <public@khwilliamson.com> wrote:
:  Then the loop innards would look like:
:
:     while (s < e) {
:         code_point = next_uvchr(s, e, &retlen);
:
:         if (retlen < 0) {

I'd recommend making this `if (retlen <= 0) {` or otherwise handling
the retlen == 0 case, even if you only expect that when s >= e: the
function should be capable of doing something reasonable on an empty
string, which probably means not croaking.

:             ... process error ...
:             retlen = -retlen;
:         }

Hugo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About