From c104fb946d40a8d5ec1c0faed4ec4eab05c33e40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=ADtor=20Santos=20Costa?= Date: Wed, 6 Jan 2016 12:36:59 +0000 Subject: [PATCH] use slots --- os/readutil.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/os/readutil.c b/os/readutil.c index 1109db91a..7c367c7f8 100644 --- a/os/readutil.c +++ b/os/readutil.c @@ -196,18 +196,20 @@ read_stream_to_codes(USES_REGS1) *HR = t; HR+=2; h0 = HR-1; + yhandle_t news, news1, st = Yap_StartSlots(); if (HR >= ASP-1024) { RESET_VARIABLE(h0); - ARG4 = AbsPair(HBASE); - ARG5 = (CELL)h0; - if (!Yap_gcl((ASP-HBASE)*sizeof(CELL), 5, ENV, Yap_gcP())) { - Yap_Error(RESOURCE_ERROR_STACK, ARG1, "read_stream_to_codes/3"); - return FALSE; + news = Yap_InitSlot(AbsPair(HBASE)); + news1 = Yap_InitSlot( (CELL)(h0)); + if (!Yap_gcl((ASP-HBASE)*sizeof(CELL), 3, ENV, Yap_gcP())) { + Yap_Error(RESOURCE_ERROR_STACK, ARG1, "read_stream_to_codes/3"); + return false; } /* build a legal term again */ - h0 = (CELL *)ARG5; - HBASE = RepPair(ARG4); + h0 = (CELL*)(Yap_GetFromSlot(news1)); + HBASE = RepPair(Yap_GetFromSlot(news)); } + Yap_CloseSlots(st); } UNLOCK(GLOBAL_Stream[sno].streamlock); if (HR == HBASE)