on master help sign in
INLINE pragma is followed by the function.
4f278e7Kazu Yamamoto
warp/Network/Wai/Handler/Warp/ReadInt.hs+1−1
@@ -27,11 +27,11 @@ readInt bs = fromIntegral $ readInt64 bs
27-- use Int64 here and then make a generic 'readInt' that allows conversion to
27-- use Int64 here and then make a generic 'readInt' that allows conversion to
28-- Int and Integer.
28-- Int and Integer.
29
29
30+{- NOINLINE readInt64MH #-}
30readInt64 :: ByteString -> Int64
31readInt64 :: ByteString -> Int64
31readInt64 bs =
32readInt64 bs =
32 B.foldl' (\i c -> i * 10 + fromIntegral (mhDigitToInt c)) 0
33 B.foldl' (\i c -> i * 10 + fromIntegral (mhDigitToInt c)) 0
33 $ B.takeWhile C.isDigit bs
34 $ B.takeWhile C.isDigit bs
34−{- NOINLINE readInt64MH #-}
35
35
36data Table = Table !Addr#
36data Table = Table !Addr#
37
37
warp/Network/Wai/Handler/Warp/Request.hs+4−5
@@ -94,14 +94,14 @@ parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
94 , vault = mempty
94 , vault = mempty
95 }, getSource)
95 }, getSource)
96
96
97−
97+{-# INLINE takeUntil #-}
98takeUntil :: Word8 -> ByteString -> ByteString
98takeUntil :: Word8 -> ByteString -> ByteString
99takeUntil c bs =
99takeUntil c bs =
100 case S.elemIndex c bs of
100 case S.elemIndex c bs of
101 Just !idx -> SU.unsafeTake idx bs
101 Just !idx -> SU.unsafeTake idx bs
102 Nothing -> bs
102 Nothing -> bs
103−{-# INLINE takeUntil #-}
104
103
104+{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
105parseFirst :: ByteString
105parseFirst :: ByteString
106 -> ResourceT IO (ByteString, ByteString, ByteString, H.HttpVersion)
106 -> ResourceT IO (ByteString, ByteString, ByteString, H.HttpVersion)
107parseFirst s =
107parseFirst s =
@@ -118,7 +118,6 @@ parseFirst s =
118 in return (method, rpath, qstring, hv)
118 in return (method, rpath, qstring, hv)
119 else throwIO NonHttp
119 else throwIO NonHttp
120 _ -> throwIO $ BadFirstLine $ B.unpack s
120 _ -> throwIO $ BadFirstLine $ B.unpack s
121−{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
122
121
123parseHeaderNoAttr :: ByteString -> H.Header
122parseHeaderNoAttr :: ByteString -> H.Header
124parseHeaderNoAttr s =
123parseHeaderNoAttr s =
@@ -134,6 +133,7 @@ data THStatus = THStatus
134 BSEndoList -- previously parsed lines
133 BSEndoList -- previously parsed lines
135 BSEndo -- bytestrings to be prepended
134 BSEndo -- bytestrings to be prepended
136
135
136+{-# INLINE takeHeaders #-}
137takeHeaders :: Sink ByteString (ResourceT IO) [ByteString]
137takeHeaders :: Sink ByteString (ResourceT IO) [ByteString]
138takeHeaders =
138takeHeaders =
139 await >>= maybe (throwIO ConnectionClosedByPeer) (push (THStatus 0 id id))
139 await >>= maybe (throwIO ConnectionClosedByPeer) (push (THStatus 0 id id))
@@ -199,12 +199,11 @@ takeHeaders =
199 let c = S.index bs (nl + 1)
199 let c = S.index bs (nl + 1)
200 in Just (nl, c == 32 || c == 9)
200 in Just (nl, c == 32 || c == 9)
201 else Just (nl, False)
201 else Just (nl, False)
202−{-# INLINE takeHeaders #-}
203
202
203+{-# INLINE checkCR #-}
204checkCR :: ByteString -> Int -> Int
204checkCR :: ByteString -> Int -> Int
205checkCR bs pos =
205checkCR bs pos =
206 let !p = pos - 1
206 let !p = pos - 1
207 in if '\r' == B.index bs p
207 in if '\r' == B.index bs p
208 then p
208 then p
209 else pos
209 else pos
210−{-# INLINE checkCR #-}