projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
5093e51
)
[project @ 2001-08-15 09:24:47 by simonmar]
author
simonmar
<unknown>
Wed, 15 Aug 2001 09:24:47 +0000
(09:24 +0000)
committer
simonmar
<unknown>
Wed, 15 Aug 2001 09:24:47 +0000
(09:24 +0000)
more wibbles
ghc/lib/std/PrelMarshalArray.lhs
patch
|
blob
|
history
diff --git
a/ghc/lib/std/PrelMarshalArray.lhs
b/ghc/lib/std/PrelMarshalArray.lhs
index
69ea69a
..
2f2a3d4
100644
(file)
--- a/
ghc/lib/std/PrelMarshalArray.lhs
+++ b/
ghc/lib/std/PrelMarshalArray.lhs
@@
-1,5
+1,5
@@
% -----------------------------------------------------------------------------
% -----------------------------------------------------------------------------
-% $Id: PrelMarshalArray.lhs,v 1.5 2001/08/15 09:19:04 simonmar Exp $
+% $Id: PrelMarshalArray.lhs,v 1.6 2001/08/15 09:24:47 simonmar Exp $
%
% (c) The FFI task force, 2000
%
%
% (c) The FFI task force, 2000
%
@@
-126,10
+126,11
@@
reallocArray0 ptr size = reallocArray ptr (size + 1)
-- needed linear stack space.
--
peekArray :: Storable a => Int -> Ptr a -> IO [a]
-- needed linear stack space.
--
peekArray :: Storable a => Int -> Ptr a -> IO [a]
-peekArray size ptr = f (size-1) []
+peekArray size ptr | size < 0 = return []
+ | othwerwise = f (size-1) []
where
f 0 acc = do e <- peekElemOff ptr 0; return (e:acc)
where
f 0 acc = do e <- peekElemOff ptr 0; return (e:acc)
- f n acc = do e <- peekElemOff ptr n; f n (e:acc)
+ f n acc = do e <- peekElemOff ptr n; f (n-1) (e:acc)
-- convert an array terminated by the given end marker into a Haskell list
--
-- convert an array terminated by the given end marker into a Haskell list
--