sv.c
/* Walk forwards to find the byte corresponding to the passed in UTF-8
   offset.  */
Walk forwards to find the byte corresponding to the passed in UTF-8
offset.
Walk forwards to find the byte corresponding to the passed in UTF - 8 offset .
static STRLEN
S_sv_pos_u2b_forwards(const U8 *const start, const U8 *const send,
		      STRLEN *const uoffset_p, bool *const at_end)
{
    const U8 *s = start;
    STRLEN uoffset = *uoffset_p;
    PERL_ARGS_ASSERT_SV_POS_U2B_FORWARDS;
    while (s < send && uoffset) {
	--uoffset;
	s += UTF8SKIP(s);
    }
    if (s == send) {
	*at_end = TRUE;
    }
    else if (s > send) {
	*at_end = TRUE;
	s = send;
    }
    *uoffset_p -= uoffset;
    return s - start;
}
static STRLEN S_sv_pos_u2b_forwards ( const U8 * const start , const U8 * const send , STRLEN * const uoffset_p , bool * const at_end ) { const U8 * s = start ; STRLEN uoffset = * uoffset_p ; PERL_ARGS_ASSERT_SV_POS_U2B_FORWARDS ; while ( s < send && uoffset ) { -- uoffset ; s += UTF8SKIP ( s ) ; } if ( s == send ) { * at_end = TRUE ; } else if ( s > send ) { * at_end = TRUE ; s = send ; } * uoffset_p -= uoffset ; return s - start ; }
Walk forwards to find the byte corresponding to the passed in UTF-8
offset.
Walk forwards to find the byte corresponding to the passed in UTF - 8 offset .
/* This is the existing behaviour. Possibly it should be a croak, as
	   it's actually a bounds error  */