Skip to content

Commit 593416e

Browse files
committed
Expose procedure for deallocating a Clause.
1 parent 64a3da5 commit 593416e

File tree

3 files changed

+19
-7
lines changed

3 files changed

+19
-7
lines changed

src/adasat-dpll.adb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55
--
66

7+
with Ada.Unchecked_Deallocation;
8+
79
with AdaSAT.Vectors;
810
with AdaSAT.Internals; use AdaSAT.Internals;
911

src/adasat.adb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,13 @@
55
--
66

77
with Ada.Strings.Unbounded;
8+
with Ada.Unchecked_Deallocation;
89

910
package body AdaSAT is
11+
12+
procedure Free_Clause is new Ada.Unchecked_Deallocation
13+
(Literal_Array, Clause);
14+
1015
---------
1116
-- "+" --
1217
---------
@@ -80,4 +85,13 @@ package body AdaSAT is
8085
end loop;
8186
return To_String (Res);
8287
end Image;
88+
89+
----------
90+
-- Free --
91+
----------
92+
93+
procedure Free (C : in out Clause) is
94+
begin
95+
Free_Clause (C);
96+
end Free;
8397
end AdaSAT;

src/adasat.ads

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
55
--
66

7-
with Ada.Unchecked_Deallocation;
8-
97
-- The root package of the AdaSAT library. Defines the base data structures
108
-- that are used everywhere else.
119
-- You should instantiate the `AdaSAT.DPLL` package with your own theory or
@@ -61,6 +59,9 @@ package AdaSAT is
6159
function Image (M : Model) return String;
6260
-- Returns a string representation of the model
6361

62+
procedure Free (C : in out Clause);
63+
-- Free memory allocated for the given clause
64+
6465
private
6566

6667
type Literal is new Integer;
@@ -72,9 +73,4 @@ private
7273
--
7374
-- Note that while both literals and variables are "just" integers, we
7475
-- cannot mix them up in our code thanks to Ada's strong type system.
75-
76-
procedure Free is new Ada.Unchecked_Deallocation
77-
(Literal_Array, Clause);
78-
-- We declare this here to make it available to each child package
79-
-- of AdaSAT.
8076
end AdaSAT;

0 commit comments

Comments
 (0)