diff --git a/C/qlyr.c b/C/qlyr.c index 2a59eb349..c350b90c4 100755 --- a/C/qlyr.c +++ b/C/qlyr.c @@ -1117,8 +1117,11 @@ YAP_file_type_t Yap_Restore(const char *s) { const char *tmp = Yap_AbsoluteFile(s, true); FILE *stream = Yap_OpenRestore(tmp); - if (!stream) + if (!stream) return -1; +#define BUFSIX 4096*256 + char *buf = malloc(BUFSIZ); + setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ); GLOBAL_RestoreFile = s; if (do_header(stream) == NIL) { pop_text_stack(lvl); @@ -1127,6 +1130,7 @@ YAP_file_type_t Yap_Restore(const char *s) { read_module(stream); setBooleanGlobalPrologFlag(SAVED_PROGRAM_FLAG, true); fclose(stream); + free(buf); GLOBAL_RestoreFile = NULL; LOCAL_SourceModule = CurrentModule = USER_MODULE; pop_text_stack(lvl); diff --git a/pl/control.yap b/pl/control.yap index 46f3702c2..81dc82fbe 100644 --- a/pl/control.yap +++ b/pl/control.yap @@ -163,7 +163,8 @@ ignore(Goal) :- (Goal->true;true). * it is both more efficient and more portable. * */ -if(X,Y,Z) :- +if(X0,Y,Z) :- + '$yap_strip_module'(X0,M,X), ( '$$save_by'(CP), '$call'(X,CP,if(X,Y,Z),M),