Skip to content

Commit

Permalink
#13: Edited TermTopCopyWithoutArgs to match flexible array member
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalNerger authored and schulzs committed Jul 30, 2020
1 parent e137f2b commit 0f6c0f1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions TERMS/cte_termtypes.h
Expand Up @@ -494,7 +494,16 @@ static Term_p inline TermDeref(Term_p term, DerefType_p deref)

static inline Term_p TermTopCopyWithoutArgs(restrict Term_p source)
{
Term_p handle = TermDefaultCellAlloc();
Term_p handle = NULL;

if(source->arity)
{
handle = TermDefaultCellArityAlloc(source->arity);
}
else
{
handle = TermDefaultCellAlloc();
}

/* All other properties are tied to the specific term! */
handle->properties = (source->properties&(TPPredPos));
Expand All @@ -506,7 +515,6 @@ static inline Term_p TermTopCopyWithoutArgs(restrict Term_p source)
if(source->arity)
{
handle->arity = source->arity;
handle->args = TermArgArrayAlloc(source->arity);
}

TermSetBank(handle, TermGetBank(source));
Expand Down

0 comments on commit 0f6c0f1

Please sign in to comment.