@@ -61,8 +61,6 @@ module stdlib_stringlist
61
61
62
62
procedure , public :: len = > length_list
63
63
64
- procedure :: capacity = > capacity_list
65
-
66
64
procedure :: to_future_at_idxn = > convert_to_future_at_idxn
67
65
68
66
procedure , public :: to_current_idxn = > convert_to_current_idxn
@@ -477,23 +475,6 @@ pure integer function length_list( list )
477
475
478
476
end function length_list
479
477
480
- ! capacity:
481
-
482
- ! > Version: experimental
483
- ! >
484
- ! > Returns the capacity of the list
485
- ! > Returns an integer
486
- pure integer function capacity_list( list )
487
- ! > Not a part of public API
488
- class(stringlist_type), intent (in ) :: list
489
-
490
- capacity_list = 0
491
- if ( allocated ( list% stringarray ) ) then
492
- capacity_list = size ( list% stringarray )
493
- end if
494
-
495
- end function capacity_list
496
-
497
478
! to_future_at_idxn:
498
479
499
480
! > Version: experimental
@@ -614,29 +595,19 @@ subroutine insert_before_empty_positions( list, idxn, positions )
614
595
old_len = list% len ()
615
596
new_len = old_len + positions
616
597
617
- if ( list% capacity() < new_len ) then
618
-
619
- allocate ( new_stringarray(new_len) )
620
-
621
- do i = 1 , idxn - 1
622
- ! TODO: can be improved by move
623
- new_stringarray(i) = list% stringarray(i)
624
- end do
625
- do i = idxn, old_len
626
- inew = i + positions
627
- ! TODO: can be improved by move
628
- new_stringarray(inew) = list% stringarray(i)
629
- end do
630
-
631
- call move_alloc( new_stringarray, list% stringarray )
632
-
633
- else
634
- do i = old_len, idxn, - 1
635
- inew = i + positions
636
- ! TODO: can be improved by move
637
- list% stringarray(inew) = list% stringarray(i)
638
- end do
639
- end if
598
+ allocate ( new_stringarray(new_len) )
599
+
600
+ do i = 1 , idxn - 1
601
+ ! TODO: can be improved by move
602
+ new_stringarray(i) = list% stringarray(i)
603
+ end do
604
+ do i = idxn, old_len
605
+ inew = i + positions
606
+ ! TODO: can be improved by move
607
+ new_stringarray(inew) = list% stringarray(i)
608
+ end do
609
+
610
+ call move_alloc( new_stringarray, list% stringarray )
640
611
641
612
list% size = new_len
642
613
0 commit comments