Fix reallocBytes: when size is zero, it is supposed to act like free.
Which it did, except that we were complaining about the NULL return
value from C's realloc and reporting it as an error.
MERGE TO STABLE
import GHC.Ptr
import GHC.Err
import GHC.Base
+import GHC.Num
#elif defined(__NHC__)
import NHC.FFI ( FinalizerPtr, CInt(..) )
import IO ( bracket )
-- C\'s @realloc()@).
--
reallocBytes :: Ptr a -> Int -> IO (Ptr a)
+reallocBytes ptr 0 = do free ptr; return nullPtr
reallocBytes ptr size =
failWhenNULL "realloc" (_realloc ptr (fromIntegral size))