moved all old source code to src-2.9 ; src will be for GF 3 development

This commit is contained in:
aarne
2008-05-20 11:47:44 +00:00
parent 747965ec22
commit fda0fe408f
494 changed files with 116978 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
module GF.Data.SharedString (shareString) where
import Data.HashTable as H
import System.IO.Unsafe (unsafePerformIO)
{-# NOINLINE stringPool #-}
stringPool :: HashTable String String
stringPool = unsafePerformIO $ new (==) hashString
{-# NOINLINE shareString #-}
shareString :: String -> String
shareString s = unsafePerformIO $ do
mv <- H.lookup stringPool s
case mv of
Just s' -> return s'
Nothing -> do
H.insert stringPool s s
return s