@@ -51,7 +51,6 @@ module stdlib_stringlist
51
51
52
52
type stringlist_type
53
53
private
54
- integer :: size = 0
55
54
type (string_type), dimension (:), allocatable :: stringarray
56
55
57
56
contains
@@ -98,7 +97,6 @@ module stdlib_stringlist
98
97
interface stringlist_type
99
98
module procedure new_stringlist
100
99
module procedure new_stringlist_carray
101
- module procedure new_stringlist_sarray
102
100
end interface
103
101
104
102
! > Version: experimental
@@ -154,7 +152,7 @@ pure function new_stringlist()
154
152
type (stringlist_type) :: new_stringlist
155
153
type (string_type), dimension (0 ) :: sarray
156
154
157
- new_stringlist = stringlist_type( 0 , sarray )
155
+ new_stringlist = stringlist_type( sarray )
158
156
159
157
end function new_stringlist
160
158
@@ -174,16 +172,6 @@ pure function new_stringlist_carray( array )
174
172
175
173
end function new_stringlist_carray
176
174
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
-
187
175
! constructor for stringlist_index_type:
188
176
189
177
! > Returns an instance of type 'stringlist_index_type' representing forward index 'idx'
@@ -455,7 +443,6 @@ end function ineq_sarray_stringlist
455
443
subroutine clear_list ( list )
456
444
class(stringlist_type), intent (inout ) :: list
457
445
458
- list% size = 0
459
446
if ( allocated ( list% stringarray ) ) then
460
447
deallocate ( list% stringarray )
461
448
end if
@@ -471,7 +458,10 @@ end subroutine clear_list
471
458
pure integer function length_list( list )
472
459
class(stringlist_type), intent (in ) :: list
473
460
474
- length_list = list% size
461
+ length_list = 0
462
+ if ( allocated ( list% stringarray ) ) then
463
+ length_list = size ( list% stringarray )
464
+ end if
475
465
476
466
end function length_list
477
467
@@ -609,8 +599,6 @@ subroutine insert_before_empty_positions( list, idxn, positions )
609
599
610
600
call move_alloc( new_stringarray, list% stringarray )
611
601
612
- list% size = new_len
613
-
614
602
end if
615
603
616
604
end subroutine insert_before_empty_positions
0 commit comments