This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
is_utf8_string(): Avoid a redundant conditional
This is actually implemented by Perl_is_utf8_string_loclen_flags(), and
until this commit unconditionally tested if the input 'len' is 0, and
does a strlen() if so. It then potentially calls one of three API
functions which each can handle an input 'len' of 0. That means each of
them test for len being 0 and call strlen() if so.
So, that means this function tests for 'len' 0, then checks to see if
any of those functions apply, and if so, calls that one, which then
tests for 'len' 0, redundantly.
But this function doesn't actually need to know the len unless none of
those three functions apply, so moving the check to later means in all
cases we only test for 'len' being 0 once.