Skip to content

Commit

Permalink
Fix PS in findIndexEnd
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodigrim committed Aug 21, 2020
1 parent 3d24783 commit b53edb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Data/ByteString.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ findIndex k (BS x l) = accursedUnutterablePerformIO $ withForeignPtr x $ \f -> g
--
-- @since 0.10.12.0
findIndexEnd :: (Word8 -> Bool) -> ByteString -> Maybe Int
findIndexEnd k (PS x s l) = accursedUnutterablePerformIO $ withForeignPtr x $ \ f -> go (f `plusPtr` s) (l-1)
findIndexEnd k (BS x l) = accursedUnutterablePerformIO $ withForeignPtr x $ \ f -> go f (l-1)
where
go !ptr !n | n < 0 = return Nothing
| otherwise = do w <- peekByteOff ptr n
Expand Down

0 comments on commit b53edb5

Please sign in to comment.