Commit dc503cef by Pascal Obry Committed by Arnaud Charlet

g-diopit.adb (Find): Fix test to exit the iterator and make sure that the iterator is quitting...

2005-12-05  Pascal Obry  <obry@adacore.com>

	* g-diopit.adb (Find): Fix test to exit the iterator and make sure that
	the iterator is quitting iteration on parent directory.

From-SVN: r108291
parent d1586072
...@@ -51,6 +51,7 @@ package body GNAT.Directory_Operations.Iteration is ...@@ -51,6 +51,7 @@ package body GNAT.Directory_Operations.Iteration is
is is
File_Regexp : constant Regexp.Regexp := Regexp.Compile (File_Pattern); File_Regexp : constant Regexp.Regexp := Regexp.Compile (File_Pattern);
Index : Natural := 0; Index : Natural := 0;
Quit : Boolean;
procedure Read_Directory (Directory : Dir_Name_Str); procedure Read_Directory (Directory : Dir_Name_Str);
-- Open Directory and read all entries. This routine is called -- Open Directory and read all entries. This routine is called
...@@ -80,7 +81,6 @@ package body GNAT.Directory_Operations.Iteration is ...@@ -80,7 +81,6 @@ package body GNAT.Directory_Operations.Iteration is
Dir : Dir_Type; Dir : Dir_Type;
Buffer : String (1 .. 2_048); Buffer : String (1 .. 2_048);
Last : Natural; Last : Natural;
Quit : Boolean;
begin begin
Open (Dir, Directory); Open (Dir, Directory);
...@@ -96,7 +96,6 @@ package body GNAT.Directory_Operations.Iteration is ...@@ -96,7 +96,6 @@ package body GNAT.Directory_Operations.Iteration is
begin begin
if Regexp.Match (Dir_Entry, File_Regexp) then if Regexp.Match (Dir_Entry, File_Regexp) then
Quit := False;
Index := Index + 1; Index := Index + 1;
begin begin
...@@ -116,6 +115,7 @@ package body GNAT.Directory_Operations.Iteration is ...@@ -116,6 +115,7 @@ package body GNAT.Directory_Operations.Iteration is
and then OS_Lib.Is_Directory (Pathname) and then OS_Lib.Is_Directory (Pathname)
then then
Read_Directory (Pathname); Read_Directory (Pathname);
exit when Quit;
end if; end if;
end; end;
end loop; end loop;
...@@ -124,6 +124,7 @@ package body GNAT.Directory_Operations.Iteration is ...@@ -124,6 +124,7 @@ package body GNAT.Directory_Operations.Iteration is
end Read_Directory; end Read_Directory;
begin begin
Quit := False;
Read_Directory (Root_Directory); Read_Directory (Root_Directory);
end Find; end Find;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment