avoid silly seek
This commit is contained in:
parent
f35f0584eb
commit
f6d434e314
7
os/mem.c
7
os/mem.c
@ -204,7 +204,7 @@ int Yap_open_buf_write_stream(encoding_t enc, memBufSource src) {
|
||||
if (sno < 0)
|
||||
return -1;
|
||||
st = GLOBAL_Stream + sno;
|
||||
st->status = Output_Stream_f | InMemory_Stream_f|FreeOnClose_Stream_f;
|
||||
st->status = Output_Stream_f | InMemory_Stream_f | FreeOnClose_Stream_f;
|
||||
st->linepos = 0;
|
||||
st->charcount = 0;
|
||||
st->linecount = 1;
|
||||
@ -267,8 +267,8 @@ char *Yap_MemExportStreamPtr(int sno) {
|
||||
#if MAY_WRITE
|
||||
char *s;
|
||||
if (fflush(GLOBAL_Stream[sno].file) == 0) {
|
||||
fseek(GLOBAL_Stream[sno].file, 0, SEEK_END);
|
||||
s = GLOBAL_Stream[sno].nbuf;
|
||||
// s[fseek(GLOBAL_Stream[sno].file, 0, SEEK_END)] = '\0';
|
||||
return s;
|
||||
}
|
||||
return NULL;
|
||||
@ -282,8 +282,7 @@ char *Yap_MemExportStreamPtr(int sno) {
|
||||
static Int peek_mem_write_stream(
|
||||
USES_REGS1) { /* '$peek_mem_write_stream'(+GLOBAL_Stream,?S0,?S) */
|
||||
Int sno =
|
||||
Yap_CheckStream(ARG1, (Output_Stream_f |
|
||||
InMemory_Stream_f), "close/2");
|
||||
Yap_CheckStream(ARG1, (Output_Stream_f | InMemory_Stream_f), "close/2");
|
||||
Int i;
|
||||
Term tf = ARG2;
|
||||
CELL *HI;
|
||||
|
Reference in New Issue
Block a user