From 4e7e9b0273366ab5c74fdaa3e6fa0dc7dd62b992 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Mon, 25 Nov 2013 11:25:56 +0100 Subject: [PATCH] use *m in Yap_strip_module, not CurrentModule --- C/modules.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/C/modules.c b/C/modules.c index 696ecd560..5b7cee586 100644 --- a/C/modules.c +++ b/C/modules.c @@ -301,12 +301,16 @@ Yap_StripModule(Term t, Term *modp) CACHE_REGS Term tmod; - tmod = CurrentModule; + if (modp) + tmod = *modp; + else + tmod = CurrentModule; restart: if (IsVarTerm(t)) { return 0L; } else if (IsAtomTerm(t) || IsPairTerm(t)) { - *modp = tmod; + if (modp) + *modp = tmod; return t; } else if (IsApplTerm(t)) { Functor fun = FunctorOfTerm(t); @@ -321,7 +325,8 @@ Yap_StripModule(Term t, Term *modp) t = ArgOfTerm(2, t); goto restart; } - *modp = tmod; + if (modp) + *modp = tmod; return t; } return 0L;