Commit 358f47f3 by Pascal Obry Committed by Arnaud Charlet

g-arrspl.adb (Free): New routine to free the source string.

2007-04-06  Pascal Obry  <obry@adacore.com>

	* g-arrspl.adb (Free) [Element_Access]: New routine to free the source
	string.
	(Create): Free the source string before storing the new one.

From-SVN: r123571
parent 9a8bd0b5
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
-- -- -- --
-- B o d y -- -- B o d y --
-- -- -- --
-- Copyright (C) 2002-2005, Free Software Foundation, Inc. -- -- Copyright (C) 2002-2006, Free Software Foundation, Inc. --
-- -- -- --
-- GNAT is free software; you can redistribute it and/or modify it under -- -- 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- -- -- terms of the GNU General Public License as published by the Free Soft- --
...@@ -41,6 +41,9 @@ package body GNAT.Array_Split is ...@@ -41,6 +41,9 @@ package body GNAT.Array_Split is
procedure Free is procedure Free is
new Ada.Unchecked_Deallocation (Separators_Indexes, Indexes_Access); new Ada.Unchecked_Deallocation (Separators_Indexes, Indexes_Access);
procedure Free is
new Ada.Unchecked_Deallocation (Element_Sequence, Element_Access);
function Count function Count
(Source : Element_Sequence; (Source : Element_Sequence;
Pattern : Element_Set) return Natural; Pattern : Element_Set) return Natural;
...@@ -81,6 +84,7 @@ package body GNAT.Array_Split is ...@@ -81,6 +84,7 @@ package body GNAT.Array_Split is
Mode : Separator_Mode := Single) Mode : Separator_Mode := Single)
is is
begin begin
Free (S.Source);
S.Source := new Element_Sequence'(From); S.Source := new Element_Sequence'(From);
Set (S, Separators, Mode); Set (S, Separators, Mode);
end Create; end Create;
......
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