Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
246dc73c
Commit
246dc73c
authored
Jan 18, 2000
by
simonmar
Browse files
[project @ 2000-01-18 12:42:12 by simonmar]
- ANSIfy - add a couple of comments about dodgy-looking code
parent
5bc7737b
Changes
1
Hide whitespace changes
Inline
Side-by-side
ghc/lib/std/cbits/readFile.c
View file @
246dc73c
/*
* (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
*
* $Id: readFile.c,v 1.
9 1999/12/0
8 1
5
:4
7:08
simonmar Exp $
* $Id: readFile.c,v 1.
10 2000/01/1
8 1
2
:4
2:12
simonmar Exp $
*
* hGetContents Runtime Support
*/
...
...
@@ -22,8 +22,7 @@
/* Filling up a (block-buffered) buffer, that
is completely empty. */
StgInt
readBlock
(
ptr
)
StgForeignPtr
ptr
;
readBlock
(
StgForeignPtr
ptr
)
{
IOFileObject
*
fo
=
(
IOFileObject
*
)
ptr
;
int
count
,
rc
=
0
;
...
...
@@ -107,10 +106,7 @@ StgForeignPtr ptr;
/* Filling up a (block-buffered) buffer of length len */
StgInt
readChunk
(
ptr
,
buf
,
len
)
StgForeignPtr
ptr
;
StgAddr
buf
;
StgInt
len
;
readChunk
(
StgForeignPtr
ptr
,
StgAddr
buf
,
StgInt
len
)
{
IOFileObject
*
fo
=
(
IOFileObject
*
)
ptr
;
int
count
=
0
,
rc
=
0
,
total_count
;
...
...
@@ -179,6 +175,9 @@ StgInt len;
if
(
count
==
0
)
{
/* EOF */
break
;
}
else
if
(
count
==
-
1
&&
errno
==
EAGAIN
)
{
/* ToDo: partial/blocked reads?????? Looks like we don't recover
* from this properly.
*/
errno
=
0
;
return
FILEOBJ_BLOCKED_READ
;
}
else
if
(
count
==
-
1
&&
errno
!=
EINTR
)
{
...
...
@@ -192,6 +191,7 @@ StgInt len;
}
total_count
+=
count
;
/* ToDo: might point beyond the end of the buffer??? */
fo
->
bufWPtr
=
total_count
;
fo
->
bufRPtr
=
0
;
return
total_count
;
...
...
@@ -207,8 +207,7 @@ StgInt len;
*/
StgInt
readLine
(
ptr
)
StgForeignPtr
ptr
;
readLine
(
StgForeignPtr
ptr
)
{
IOFileObject
*
fo
=
(
IOFileObject
*
)
ptr
;
int
rc
=
0
,
count
;
...
...
@@ -270,8 +269,7 @@ StgForeignPtr ptr;
}
StgInt
readChar
(
ptr
)
StgForeignPtr
ptr
;
readChar
(
StgForeignPtr
ptr
)
{
IOFileObject
*
fo
=
(
IOFileObject
*
)
ptr
;
int
count
,
rc
=
0
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment