Skip to content

Commit 8f088b3

Browse files
jvdp1awvwgk
andauthored
Update src/stdlib_string_type.fypp
Co-authored-by: Sebastian Ehlert <28669218+awvwgk@users.noreply.github.com>
1 parent ae4a38f commit 8f088b3

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/stdlib_string_type.fypp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -681,11 +681,10 @@ contains
681681
elemental subroutine move_string_string(from, to)
682682
type(string_type), intent(inout) :: from
683683
type(string_type), intent(inout) :: to
684+
character(:), allocatable :: tmp
684685

685-
if(.not.allocated(from%raw))then
686-
if(allocated(to%raw))deallocate(to%raw)
687-
return
688-
endif
686+
call move_alloc(from%raw, tmp)
687+
call move_alloc(tmp, to%raw)
689688

690689
if(from%raw .eq. to%raw)then
691690
deallocate(from%raw)

0 commit comments

Comments
 (0)