Skip to content

Commit a0c20cc

Browse files
committed
replaced copy function with appropriate comments
1 parent afb318e commit a0c20cc

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

src/stdlib_stringlist.f90

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ module stdlib_stringlist
5757

5858
contains
5959
private
60-
procedure :: copy => create_copy
6160

6261
procedure, public :: clear => clear_list
6362

@@ -208,17 +207,6 @@ pure function backward_index( idx )
208207

209208
end function backward_index
210209

211-
! copy
212-
213-
!> Returns a deep copy of the stringlist 'original'
214-
pure function create_copy( original )
215-
class(stringlist_type), intent(in) :: original
216-
type(stringlist_type) :: create_copy
217-
218-
create_copy = original
219-
220-
end function create_copy
221-
222210
! concatenation operator:
223211

224212
!> Appends character scalar 'string' to the stringlist 'list'
@@ -239,7 +227,7 @@ function append_string( list, string )
239227
type(string_type), intent(in) :: string
240228
type(stringlist_type) :: append_string
241229

242-
append_string = list%copy()
230+
append_string = list ! Intent: creating a full, deep copy
243231
call append_string%insert_at( list_tail, string )
244232

245233
end function append_string
@@ -262,7 +250,7 @@ function prepend_string( string, list )
262250
type(stringlist_type), intent(in) :: list
263251
type(stringlist_type) :: prepend_string
264252

265-
prepend_string = list%copy()
253+
prepend_string = list ! Intent: creating a full, deep copy
266254
call prepend_string%insert_at( list_head, string )
267255

268256
end function prepend_string
@@ -274,7 +262,7 @@ function append_stringlist( list, slist )
274262
type(stringlist_type), intent(in) :: slist
275263
type(stringlist_type) :: append_stringlist
276264

277-
append_stringlist = list%copy()
265+
append_stringlist = list ! Intent: creating a full, deep copy
278266
call append_stringlist%insert_at( list_tail, slist )
279267

280268
end function append_stringlist
@@ -286,7 +274,7 @@ function append_carray( list, carray )
286274
character(len=*), dimension(:), intent(in) :: carray
287275
type(stringlist_type) :: append_carray
288276

289-
append_carray = list%copy()
277+
append_carray = list ! Intent: creating a full, deep copy
290278
call append_carray%insert_at( list_tail, carray )
291279

292280
end function append_carray
@@ -298,7 +286,7 @@ function append_sarray( list, sarray )
298286
type(string_type), dimension(:), intent(in) :: sarray
299287
type(stringlist_type) :: append_sarray
300288

301-
append_sarray = list%copy()
289+
append_sarray = list ! Intent: creating a full, deep copy
302290
call append_sarray%insert_at( list_tail, sarray )
303291

304292
end function append_sarray
@@ -310,7 +298,7 @@ function prepend_carray( carray, list )
310298
type(stringlist_type), intent(in) :: list
311299
type(stringlist_type) :: prepend_carray
312300

313-
prepend_carray = list%copy()
301+
prepend_carray = list ! Intent: creating a full, deep copy
314302
call prepend_carray%insert_at( list_head, carray )
315303

316304
end function prepend_carray
@@ -322,7 +310,7 @@ function prepend_sarray( sarray, list )
322310
type(stringlist_type), intent(in) :: list
323311
type(stringlist_type) :: prepend_sarray
324312

325-
prepend_sarray = list%copy()
313+
prepend_sarray = list ! Intent: creating a full, deep copy
326314
call prepend_sarray%insert_at( list_head, sarray )
327315

328316
end function prepend_sarray

0 commit comments

Comments
 (0)