util_string: dynamically allocate and expand string lists
String lists grow dynamically, removing the need for preallocated arrays. This simplifies handling of large variable groups in the icon initialization phase.
The output lists of add_to_list
are now ALLOCATABLE
. They may be passed an unallocated
argument, which is treated like an empty list and allocated using the new new_list
subroutine. That subroutine initially allocates space for 8 strings. Every time the list
needs to grow, the allocated size doubles. This ensures constant amortized runtime for
adding to the list. No provisions are made for shrinking the list size, because they are
usually short-lived.
The tests for add_to_list
are adapted for the new interface, checking list expansion.
A new test for new_list
is added.
Merge request reports
Activity
added 7 commits
-
69eeef0d...1651516a - 3 commits from branch
master
- 9724841a - dynamically allocate and expand string lists
- 7c18e0f4 - util_string: remove unused variable
- 5351284c - test_util_string: add unit test for new_list and expansion test for add_to_list
- 4ab43c97 - fshi^H^H^Hprettify
Toggle commit list-
69eeef0d...1651516a - 3 commits from branch
- Resolved by Yen-Chen Chen
@b381588 Hi. Is this MR ready for review?
added ready for review label
assigned to @b381588
- Resolved by Yen-Chen Chen
requested review from @b382190
added 1 commit
- 7b7ad6a4 - test_util_string: fix test tags, cover untested line in add_to_list_1