From 144cedec159574df474579fa2cc7fde7e61eadbc Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Tue, 9 Nov 2021 20:46:38 +0100 Subject: lists: add a subtype for valid lists --- src/lists.adb | 2 +- src/lists.ads | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lists.adb b/src/lists.adb index 1acbbbf38..a4585f79a 100644 --- a/src/lists.adb +++ b/src/lists.adb @@ -169,7 +169,7 @@ package body Lists is Chunk_Free_List := No_Chunk_Index; end Initialize; - function Iterate (List : List_Type) return Iterator + function Iterate (List : List_Valid_Type) return Iterator is L : List_Record renames Listt.Table (List); begin diff --git a/src/lists.ads b/src/lists.ads index a4359b51b..d06170223 100644 --- a/src/lists.ads +++ b/src/lists.ads @@ -24,6 +24,8 @@ package Lists is Null_List : constant List_Type := 0; List_All : constant List_Type := 1; + subtype List_Valid_Type is List_Type range List_All + 1 .. List_Type'Last; + ----------- -- Lists -- ----------- @@ -99,7 +101,7 @@ package Lists is -- end loop; type Iterator is private; - function Iterate (List : List_Type) return Iterator; + function Iterate (List : List_Valid_Type) return Iterator; function Is_Valid (It : Iterator) return Boolean; procedure Next (It : in out Iterator); function Get_Element (It : Iterator) return El_Type; -- cgit v1.2.3