summaryrefslogtreecommitdiff
path: root/gcc/ada/g-awk.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-27 14:15:42 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-01-27 14:15:42 +0000
commit4d6fa7a27b102733d52ecc14b7bda22e5fbcebb7 (patch)
tree306ec243504f4966a74c0cedbc57b00e91e4063d /gcc/ada/g-awk.adb
parent21871cb76bf907321f5fcb153a45548e2cc8797e (diff)
downloadgcc-4d6fa7a27b102733d52ecc14b7bda22e5fbcebb7.tar.gz
2010-01-27 Pascal Obry <obry@adacore.com>
* g-awk.adb: ensure that an AWK session is reusable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@156285 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/g-awk.adb')
-rw-r--r--gcc/ada/g-awk.adb22
1 files changed, 11 insertions, 11 deletions
diff --git a/gcc/ada/g-awk.adb b/gcc/ada/g-awk.adb
index 0dee657b140..6c8fa1a8bb8 100644
--- a/gcc/ada/g-awk.adb
+++ b/gcc/ada/g-awk.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2000-2008, AdaCore --
+-- Copyright (C) 2000-2010, AdaCore --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -294,6 +294,10 @@ package body GNAT.AWK is
-- We release the session data only if it is not the default session
if Session.Data /= Get_Def then
+ -- Release separators
+
+ Free (Session.Data.Separators);
+
Free (Session.Data);
-- Since we have closed the current session, set it to point now to
@@ -485,11 +489,10 @@ package body GNAT.AWK is
procedure Current_Line (S : Separator; Session : Session_Type) is
Line : constant String := To_String (Session.Data.Current_Line);
Fields : Field_Table.Instance renames Session.Data.Fields;
+ Seps : constant Maps.Character_Set := Maps.To_Set (S.Separators);
- Start : Natural;
- Stop : Natural;
-
- Seps : constant Maps.Character_Set := Maps.To_Set (S.Separators);
+ Start : Natural;
+ Stop : Natural;
begin
-- First field start here
@@ -506,8 +509,8 @@ package body GNAT.AWK is
-- Look for next separator
Stop := Fixed.Index
- (Source => Line (Start .. Line'Last),
- Set => Seps);
+ (Source => Line (Start .. Line'Last),
+ Set => Seps);
exit when Stop = 0;
@@ -526,6 +529,7 @@ package body GNAT.AWK is
if Start = 0 then
Start := Stop + 1;
end if;
+
else
Start := Stop + 1;
end if;
@@ -707,10 +711,6 @@ package body GNAT.AWK is
Text_IO.Close (Session.Data.Current_File);
end if;
- -- Release separators
-
- Free (Session.Data.Separators);
-
-- Release Filters table
for F in 1 .. Pattern_Action_Table.Last (Filters) loop