From: sof Date: Sun, 19 Sep 1999 19:26:14 +0000 (+0000) Subject: [project @ 1999-09-19 19:26:14 by sof] X-Git-Tag: Approximately_9120_patches~5764 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=939e75b882d6c73ded99061c376c5e0f4475c321;p=ghc-hetmet.git [project @ 1999-09-19 19:26:14 by sof] wibble --- diff --git a/ghc/lib/std/cbits/flushFile.c b/ghc/lib/std/cbits/flushFile.c index d556d5a..190d78a 100644 --- a/ghc/lib/std/cbits/flushFile.c +++ b/ghc/lib/std/cbits/flushFile.c @@ -1,7 +1,7 @@ /* * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998 * - * $Id: flushFile.c,v 1.4 1999/01/15 17:54:23 sof Exp $ + * $Id: flushFile.c,v 1.5 1999/09/19 19:26:14 sof Exp $ * * hFlush Runtime Support */ @@ -16,7 +16,7 @@ StgForeignPtr ptr; IOFileObject* fo = (IOFileObject*)ptr; int rc = 0; - if ( (fo->flags & FILEOBJ_FLUSH) && !FILEOBJ_BUFFER_EMPTY(fo) ) { + if ( (fo->flags & FILEOBJ_FLUSH) && FILEOBJ_NEEDS_FLUSHING(fo) ) { rc = writeBuffer(ptr,fo->bufWPtr - fo->bufRPtr); } @@ -30,11 +30,12 @@ StgForeignPtr ptr; IOFileObject* fo = (IOFileObject*)ptr; int rc = 0; - /* If the file object is writeable, or if its - RW and the last operation on it was a write, + /* If the file object is writeable, or if it's + RW *and* the last operation on it was a write, flush it. */ - if ( (!FILEOBJ_READABLE(fo) && FILEOBJ_WRITEABLE(fo)) || (FILEOBJ_RW(fo) && FILEOBJ_JUST_WRITTEN(fo)) ) { + if ( (!FILEOBJ_READABLE(fo) && FILEOBJ_WRITEABLE(fo)) || + (FILEOBJ_RW(fo) && FILEOBJ_JUST_WRITTEN(fo)) ) { rc = flushFile(ptr); if (rc<0) return rc; }