avoid unnecessrily using slots in Input/Output calls or just because I need a stream. This can lead to hard to

catch stack bugs.
This commit is contained in:
Vítor Santos Costa
2012-02-18 11:01:06 +00:00
parent d777ff863a
commit 1531002f26
9 changed files with 158 additions and 53 deletions

View File

@@ -2704,11 +2704,11 @@ YAP_TermToStream(Term t)
{
CACHE_REGS
IOSTREAM *s;
int rc;
extern int PL_get_stream_handle(Int t, IOSTREAM **s);
BACKUP_MACHINE_REGS();
if ( (rc=PL_get_stream_handle(Yap_InitSlot(t PASS_REGS), &s)) ) {
if (IsVarTerm(t) || !IsAtomTerm(t))
return NULL;
if ( (s=Yap_GetStreamHandle(AtomOfTerm(t))) ) {
RECOVER_MACHINE_REGS();
return s;
}