From faf742672ebbfc9dadb57dfbd99d77a2ec20fb5b Mon Sep 17 00:00:00 2001 From: ken Date: Mon, 22 Apr 2002 04:40:25 +0000 Subject: [PATCH] [project @ 2002-04-22 04:40:25 by ken] Replace strncmp() with memcmp() for comparing non-zero-terminated strings. --- ghc/compiler/utils/PrimPacked.lhs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghc/compiler/utils/PrimPacked.lhs b/ghc/compiler/utils/PrimPacked.lhs index 5c4e27e..da16a33 100644 --- a/ghc/compiler/utils/PrimPacked.lhs +++ b/ghc/compiler/utils/PrimPacked.lhs @@ -170,7 +170,7 @@ Compare two equal-length strings for equality: eqStrPrefix :: Addr# -> ByteArray# -> Int# -> Bool eqStrPrefix a# barr# len# = unsafePerformIO ( - _ccall_ strncmp (A# a#) (ByteArray bot bot barr#) (I# len#) >>= \ (I# x#) -> + _ccall_ memcmp (A# a#) (ByteArray bot bot barr#) (I# len#) >>= \ (I# x#) -> return (x# ==# 0#)) where bot :: Int @@ -179,13 +179,13 @@ eqStrPrefix a# barr# len# = eqCharStrPrefix :: Addr# -> Addr# -> Int# -> Bool eqCharStrPrefix a1# a2# len# = unsafePerformIO ( - _ccall_ strncmp (A# a1#) (A# a2#) (I# len#) >>= \ (I# x#) -> + _ccall_ memcmp (A# a1#) (A# a2#) (I# len#) >>= \ (I# x#) -> return (x# ==# 0#)) eqStrPrefixBA :: ByteArray# -> ByteArray# -> Int# -> Int# -> Bool eqStrPrefixBA b1# b2# start# len# = unsafePerformIO ( - _casm_ ``%r=(int)strncmp((char *)%0+(int)%1,%2,%3); '' + _casm_ ``%r=(int)memcmp((char *)%0+(int)%1,%2,%3); '' (ByteArray bot bot b2#) (I# start#) (ByteArray bot bot b1#) @@ -198,7 +198,7 @@ eqStrPrefixBA b1# b2# start# len# = eqCharStrPrefixBA :: Addr# -> ByteArray# -> Int# -> Int# -> Bool eqCharStrPrefixBA a# b2# start# len# = unsafePerformIO ( - _casm_ ``%r=(int)strncmp((char *)%0+(int)%1,%2,%3); '' + _casm_ ``%r=(int)memcmp((char *)%0+(int)%1,%2,%3); '' (ByteArray bot bot b2#) (I# start#) (A# a#) -- 1.7.10.4