summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/eval.c b/eval.c
index d482b7d..e490eb6 100644
--- a/eval.c
+++ b/eval.c
@@ -20,12 +20,12 @@ evalquery(Term *query, Binding **resultbindings)
and to get the result we can unify the original query with the one at the bottom of the stack, to get the bindings
applied.
*/
- goalstack = malloc(sizeof(Goal));
+ goalstack = gmalloc(sizeof(Goal));
goalstack->goal = copyterm(query, nil);
goalstack->module = usermodule;
goalstack->catcher = nil;
goalstack->next = nil;
- Goal *protector = malloc(sizeof(Goal));
+ Goal *protector = gmalloc(sizeof(Goal));
protector->goal = nil;
protector->module = usermodule;
protector->catcher = mkvariable(L"catch-var");
@@ -125,7 +125,7 @@ addgoals(Goal *goals, Term *t, Module *module)
}else
t = typeerror(L"module", moduleterm);
}
- Goal *g = malloc(sizeof(Goal));
+ Goal *g = gmalloc(sizeof(Goal));
g->goal = t;
g->module = module;
g->catcher = nil;
@@ -198,7 +198,7 @@ unify(Term *a, Term *b, Binding **bindings)
if(runestrcmp(left->text, L"_") == 0)
continue; /* _ doesn't introduce a new binding */
- Binding *b = malloc(sizeof(Binding));
+ Binding *b = gmalloc(sizeof(Binding));
b->name = left->text;
b->nr = left->clausenr;
b->value = right;
@@ -280,7 +280,7 @@ Goal *
copygoals(Goal *goals)
{
if(goals != nil){
- Goal *g = malloc(sizeof(Goal));
+ Goal *g = gmalloc(sizeof(Goal));
g->module = goals->module;
if(goals->goal)
g->goal = copyterm(goals->goal, nil);
@@ -308,7 +308,7 @@ addchoicepoints(Clause *clause, Term *goal, Goal *goals, Module *mod){
clause = findclause(alt, goal, &altbindings);
if(clause){
/* Add choicepoint here */
- Choicepoint *cp = malloc(sizeof(Choicepoint));
+ Choicepoint *cp = gmalloc(sizeof(Choicepoint));
cp->goalstack = copygoals(goals);
cp->next = nil;
cp->alternative = clause;