@@ -51,7 +51,6 @@ module stdlib_stringlist
5151
5252 type stringlist_type
5353 private
54- integer :: size = 0
5554 type (string_type), dimension (:), allocatable :: stringarray
5655
5756 contains
@@ -98,7 +97,6 @@ module stdlib_stringlist
9897 interface stringlist_type
9998 module procedure new_stringlist
10099 module procedure new_stringlist_carray
101- module procedure new_stringlist_sarray
102100 end interface
103101
104102 ! > Version: experimental
@@ -154,7 +152,7 @@ pure function new_stringlist()
154152 type (stringlist_type) :: new_stringlist
155153 type (string_type), dimension (0 ) :: sarray
156154
157- new_stringlist = stringlist_type( 0 , sarray )
155+ new_stringlist = stringlist_type( sarray )
158156
159157 end function new_stringlist
160158
@@ -174,16 +172,6 @@ pure function new_stringlist_carray( array )
174172
175173 end function new_stringlist_carray
176174
177- ! > Constructor to convert stringarray to stringlist
178- ! > Returns a new instance of type stringlist
179- pure function new_stringlist_sarray ( array )
180- type (string_type), dimension (:), intent (in ) :: array
181- type (stringlist_type) :: new_stringlist_sarray
182-
183- new_stringlist_sarray = stringlist_type( size (array), array )
184-
185- end function new_stringlist_sarray
186-
187175 ! constructor for stringlist_index_type:
188176
189177 ! > Returns an instance of type 'stringlist_index_type' representing forward index 'idx'
@@ -455,7 +443,6 @@ end function ineq_sarray_stringlist
455443 subroutine clear_list ( list )
456444 class(stringlist_type), intent (inout ) :: list
457445
458- list% size = 0
459446 if ( allocated ( list% stringarray ) ) then
460447 deallocate ( list% stringarray )
461448 end if
@@ -471,7 +458,10 @@ end subroutine clear_list
471458 pure integer function length_list( list )
472459 class(stringlist_type), intent (in ) :: list
473460
474- length_list = list% size
461+ length_list = 0
462+ if ( allocated ( list% stringarray ) ) then
463+ length_list = size ( list% stringarray )
464+ end if
475465
476466 end function length_list
477467
@@ -609,8 +599,6 @@ subroutine insert_before_empty_positions( list, idxn, positions )
609599
610600 call move_alloc( new_stringarray, list% stringarray )
611601
612- list% size = new_len
613-
614602 end if
615603
616604 end subroutine insert_before_empty_positions
0 commit comments