This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
sv.c:sv_utf8_encode: simplify code
[perl5.git] / sv.c
diff --git a/sv.c b/sv.c
index 3094274..c1ece77 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -3521,11 +3521,8 @@ Perl_sv_utf8_encode(pTHX_ register SV *const sv)
 {
     PERL_ARGS_ASSERT_SV_UTF8_ENCODE;
 
-    if (SvIsCOW(sv)) {
-        sv_force_normal_flags(sv, 0);
-    }
     if (SvREADONLY(sv)) {
-       Perl_croak_no_modify(aTHX);
+       sv_force_normal_flags(sv, 0);
     }
     (void) sv_utf8_upgrade(sv);
     SvUTF8_off(sv);