diff options
author | Jerome Lambourg <lambourg@adacore.com> | 2005-09-05 09:54:22 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2005-09-05 09:54:22 +0200 |
commit | dd52e06aa0e9341c1123de64c7ff2b46b60b7ba3 (patch) | |
tree | 9fec5a0581c26df7b80a9616753c38a30f22cc6e /gcc | |
parent | 829c2849c102e33c9f0d932445229406d4478b8f (diff) | |
download | gcc-dd52e06aa0e9341c1123de64c7ff2b46b60b7ba3.zip gcc-dd52e06aa0e9341c1123de64c7ff2b46b60b7ba3.tar.gz gcc-dd52e06aa0e9341c1123de64c7ff2b46b60b7ba3.tar.bz2 |
g-expect.adb (Non_Blocking_Spawn): Initialize the filters field to
2005-09-01 Jerome Lambourg <lambourg@adacore.com>
* g-expect.adb (Non_Blocking_Spawn): Initialize the filters field to
(Free): New deallocation procedure for filter elements
(Close): Deallocate any existing filter for the concerned connection
From-SVN: r103866
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/g-expect.adb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gcc/ada/g-expect.adb b/gcc/ada/g-expect.adb index 6f0f7cf..e94d5b6 100644 --- a/gcc/ada/g-expect.adb +++ b/gcc/ada/g-expect.adb @@ -69,6 +69,9 @@ package body GNAT.Expect is procedure Free is new Unchecked_Deallocation (Pattern_Matcher, Pattern_Matcher_Access); + procedure Free is new Unchecked_Deallocation + (Filter_List_Elem, Filter_List); + procedure Call_Filters (Pid : Process_Descriptor'Class; Str : String; @@ -204,6 +207,9 @@ package body GNAT.Expect is (Descriptor : in out Process_Descriptor; Status : out Integer) is + Current_Filter : Filter_List; + Next_Filter : Filter_List; + begin Close (Descriptor.Input_Fd); @@ -214,11 +220,21 @@ package body GNAT.Expect is Close (Descriptor.Output_Fd); -- ??? Should have timeouts for different signals + Kill (Descriptor.Pid, 9); GNAT.OS_Lib.Free (Descriptor.Buffer); Descriptor.Buffer_Size := 0; + Current_Filter := Descriptor.Filters; + + while Current_Filter /= null loop + Next_Filter := Current_Filter.Next; + Free (Current_Filter); + Current_Filter := Next_Filter; + end loop; + + Descriptor.Filters := null; Status := Waitpid (Descriptor.Pid); end Close; @@ -1001,6 +1017,10 @@ package body GNAT.Expect is if Buffer_Size /= 0 then Descriptor.Buffer := new String (1 .. Positive (Buffer_Size)); end if; + + -- Initialize the filters + + Descriptor.Filters := null; end Non_Blocking_Spawn; ------------------------- |