This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
make dNOOP usable outside function in C++
[perl5.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index 31b7db7..3123bd0 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -2004,9 +2004,12 @@ Perl_utf8_to_uvuni_buf(pTHX_ const U8 *s, const U8 *send, STRLEN *retlen)
 /*
 =for apidoc utf8_length
 
-Return the length of the UTF-8 char encoded string C<s> in characters.
-Stops at C<e> (i.e. the C<*e> byte does not form part of the character).
-If C<e E<lt> s> or if the scan would end up past C<e>, it croaks.
+Returns the number of characters in the sequence of UTF-8-encoded bytes starting
+at C<s> and ending at the byte just before C<e>.  If <s> and <e> point to the
+same place, it returns 0 with no warning raised.
+
+If C<e E<lt> s> or if the scan would end up past C<e>, it raises a UTF8 warning
+and returns the number of valid characters.
 
 =cut
 */
@@ -2306,8 +2309,8 @@ Perl_bytes_from_utf8_loc(const U8 *s, STRLEN *lenp, bool *is_utf8p, const U8** f
     }
 
   finish_and_return:
-        *d = '\0';
-        *lenp = d - converted_start;
+    *d = '\0';
+    *lenp = d - converted_start;
 
     /* Trim unused space */
     Renew(converted_start, *lenp + 1, U8);