From e197e455664ca60f1133943d23cbc0cb046fe513 Mon Sep 17 00:00:00 2001 From: Martin Diehl Date: Thu, 22 Jun 2023 23:25:25 +0200 Subject: [PATCH] use existing functionality --- src/IO.f90 | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/IO.f90 b/src/IO.f90 index 6ba1f3165..5b3cae71c 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -320,6 +320,7 @@ function IO_rmComment(line) character(len=*), intent(in) :: line character(len=:), allocatable :: IO_rmComment + integer :: split @@ -335,7 +336,7 @@ end function IO_rmComment !-------------------------------------------------------------------------------------------------- -! @brief Return first (with glued on second if they differ) +! @brief Return first (with glued on second if they differ). !-------------------------------------------------------------------------------------------------- function IO_glueDiffering(first,second,glue) @@ -343,14 +344,11 @@ function IO_glueDiffering(first,second,glue) character(len=*), intent(in) :: second character(len=*), optional, intent(in) :: glue character(len=:), allocatable :: IO_glueDiffering + character(len=pSTRLEN) :: glue_ - if (present(glue)) then - glue_ = glue - else - glue_ = '<--' - end if + glue_ = misc_optional(glue,'<--') IO_glueDiffering = trim(first) if (trim(first) /= trim(second)) IO_glueDiffering = IO_glueDiffering//' '//trim(glue_)//' '//trim(second) @@ -363,9 +361,9 @@ end function IO_glueDiffering function IO_intAsStr(i) integer, intent(in) :: i - character(len=:), allocatable :: IO_intAsStr + allocate(character(len=merge(2,1,i<0) + floor(log10(real(abs(merge(1,i,i==0))))))::IO_intAsStr) write(IO_intAsStr,'(i0)') i