Commit fda7f6a2 authored by sof's avatar sof
Browse files

[project @ 1999-01-23 17:40:07 by sof]

Tag all 'foreign import's as being unsafe.
parent dddefa4e
...@@ -98,7 +98,7 @@ getEnv name = do ...@@ -98,7 +98,7 @@ getEnv name = do
else ioError (IOError Nothing NoSuchThing "getEnv" else ioError (IOError Nothing NoSuchThing "getEnv"
("environment variable: " ++ name)) ("environment variable: " ++ name))
foreign import ccall "libHS_cbits.so" "getenv" primGetEnv :: PrimByteArray -> IO Addr foreign import ccall "libHS_cbits.so" "getenv" unsafe primGetEnv :: PrimByteArray -> IO Addr
\end{code} \end{code}
Computation $system cmd$ returns the exit code Computation $system cmd$ returns the exit code
...@@ -124,7 +124,7 @@ system cmd = do ...@@ -124,7 +124,7 @@ system cmd = do
-1 -> constructErrorAndFailWithInfo "system" cmd -1 -> constructErrorAndFailWithInfo "system" cmd
n -> return (ExitFailure n) n -> return (ExitFailure n)
foreign import ccall "libHS_cbits.so" "systemCmd" primSystem :: PrimByteArray -> IO Int foreign import ccall "libHS_cbits.so" "systemCmd" unsafe primSystem :: PrimByteArray -> IO Int
\end{code} \end{code}
@exitWith code@ terminates the program, returning {\em code} to the program's caller. @exitWith code@ terminates the program, returning {\em code} to the program's caller.
...@@ -142,7 +142,7 @@ exitWith (ExitFailure n) ...@@ -142,7 +142,7 @@ exitWith (ExitFailure n)
primExit n primExit n
ioError (IOError Nothing OtherError "exitWith" "exit should not return") ioError (IOError Nothing OtherError "exitWith" "exit should not return")
foreign import ccall "libHS_cbits.so" "exit" primExit :: Int -> IO () foreign import ccall "libHS_cbits.so" "exit" unsafe primExit :: Int -> IO ()
exitFailure :: IO a exitFailure :: IO a
exitFailure = exitWith (ExitFailure 1) exitFailure = exitWith (ExitFailure 1)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment