projects
/
mate.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
debug: use #ifdef guards
[mate.git]
/
Mate
/
Strings.hs
diff --git
a/Mate/Strings.hs
b/Mate/Strings.hs
index 435f6ec08fda6861c81e2183596f940f52373e73..ba2166364aca3c3537ac119655a34924b708eb15 100644
(file)
--- a/
Mate/Strings.hs
+++ b/
Mate/Strings.hs
@@
-1,3
+1,4
@@
+{-# LANGUAGE CPP #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module Mate.Strings (
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ForeignFunctionInterface #-}
module Mate.Strings (
@@
-8,7
+9,9
@@
import Data.Word
import qualified Data.Map as M
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Internal as BI
import qualified Data.Map as M
import qualified Data.ByteString.Lazy as B
import qualified Data.ByteString.Internal as BI
+#ifdef DEBUG
import Text.Printf
import Text.Printf
+#endif
import Foreign.Ptr
import Foreign.Marshal.Alloc
import Foreign.Ptr
import Foreign.Marshal.Alloc
@@
-39,5
+42,7
@@
allocateJavaString str = do
BI.memset newstr 0 (fromIntegral $ strlen + 1)
copyBytes newstr arr strlen
let w32_ptr = fromIntegral $ ptrToIntPtr newstr
BI.memset newstr 0 (fromIntegral $ strlen + 1)
copyBytes newstr arr strlen
let w32_ptr = fromIntegral $ ptrToIntPtr newstr
+#ifdef DEBUG
printf "new str ptr: 0x%08x (%s)@%d\n" w32_ptr (toString str) strlen
printf "new str ptr: 0x%08x (%s)@%d\n" w32_ptr (toString str) strlen
+#endif
return w32_ptr
return w32_ptr