Skip to content

Commit cab1ec8

Browse files
committed
perlapi: Clarify utf8_hop backwards entries
1 parent 49f9ecc commit cab1ec8

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

inline.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,9 +1987,15 @@ Perl_utf8_distance(pTHX_ const U8 *a, const U8 *b)
19871987
Return the UTF-8 pointer C<s> displaced by C<off> characters, either
19881988
forward or backward.
19891989
1990-
WARNING: do not use the following unless you *know* C<off> is within
1991-
the UTF-8 data pointed to by C<s> *and* that on entry C<s> is aligned
1992-
on the first byte of character or just after the last byte of a character.
1990+
WARNING: Prefer L</utf8_hop_safe> to this one.
1991+
1992+
Do NOT use this function unless you B<know> C<off> is within
1993+
the UTF-8 data pointed to by C<s> B<and> that on entry C<s> is aligned
1994+
on the first byte of a character or just after the last byte of a character.
1995+
1996+
If <off> is negative, C<s> does not need to be pointing to the starting byte of
1997+
a character. If it isn't, one count of C<off> will be used up to get to that
1998+
start.
19931999
19942000
=cut
19952001
*/
@@ -2067,7 +2073,9 @@ Perl_utf8_hop_forward(const U8 *s, SSize_t off, const U8 *end)
20672073
=for apidoc utf8_hop_back
20682074
20692075
Return the UTF-8 pointer C<s> displaced by up to C<off> characters,
2070-
backward.
2076+
backward. C<s> does not need to be pointing to the starting byte of a
2077+
character. If it isn't, one count of C<off> will be used up to get to that
2078+
start.
20712079
20722080
C<off> must be non-positive.
20732081

0 commit comments

Comments
 (0)