This commit is contained in:
Vitor Santos Costa 2016-07-31 04:46:51 -05:00
parent 35e9d432c1
commit 7d6082d39a

View File

@ -1274,7 +1274,6 @@ void Yap_plwrite(Term t, StreamDesc *mywrite, int max_depth, int flags,
char *Yap_TermToString(Term t, size_t *lengthp, encoding_t enc, int flags) {
CACHE_REGS
int sno = Yap_open_buf_write_stream(enc, flags);
int old_output_stream = LOCAL_c_output_stream;
const char *sf;
if (sno < 0)
@ -1285,9 +1284,9 @@ char *Yap_TermToString(Term t, size_t *lengthp, encoding_t enc, int flags) {
else
GLOBAL_Stream[sno].encoding = LOCAL_encoding;
Yap_plwrite(t, GLOBAL_Stream + sno, 0, flags, GLOBAL_MaxPriority);
sf = Yap_MemExportStreamPtr(sno);
Yap_CloseStream(sno);
LOCAL_c_output_stream = old_output_stream;
if (Yap_HasException())
return NULL;
return (char *)sf;