This commit is contained in:
Vitor Santos Costa 2019-05-21 13:50:41 +01:00
parent 8c3c3f921c
commit e7535dd2ee
2 changed files with 7 additions and 2 deletions

View File

@ -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);

View File

@ -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),