on master help sign in
INLINE pragma is followed by the function.
commit4f278e7c8675c32802c1b76deb5b34a8eabbd031 authorKazu Yamamoto <kazu@iij.ad.jp> dateTue 14 Aug 2012, 15:45 (14 years ago) parent32e66cb
2 files changed+5−6
warp/Network/Wai/Handler/Warp/ReadInt.hs+1−1 warp/Network/Wai/Handler/Warp/Request.hs+4−5
warp/Network/Wai/Handler/Warp/ReadInt.hs+1−1
@@ -27,11 +27,11 @@ readInt bs = fromIntegral $ readInt64 bs
2727-- use Int64 here and then make a generic 'readInt' that allows conversion to
2828-- Int and Integer.
2929
30+{- NOINLINE readInt64MH #-}
3031readInt64 :: ByteString -> Int64
3132readInt64 bs =
3233 B.foldl' (\i c -> i * 10 + fromIntegral (mhDigitToInt c)) 0
3334 $ B.takeWhile C.isDigit bs
34−{- NOINLINE readInt64MH #-}
3535
3636data Table = Table !Addr#
3737
warp/Network/Wai/Handler/Warp/Request.hs+4−5
@@ -94,14 +94,14 @@ parseRequest' conn port (firstLine:otherLines) remoteHost' src = do
9494 , vault = mempty
9595 }, getSource)
9696
97−
97+{-# INLINE takeUntil #-}
9898takeUntil :: Word8 -> ByteString -> ByteString
9999takeUntil c bs =
100100 case S.elemIndex c bs of
101101 Just !idx -> SU.unsafeTake idx bs
102102 Nothing -> bs
103−{-# INLINE takeUntil #-}
104103
104+{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
105105parseFirst :: ByteString
106106 -> ResourceT IO (ByteString, ByteString, ByteString, H.HttpVersion)
107107parseFirst s =
@@ -118,7 +118,6 @@ parseFirst s =
118118 in return (method, rpath, qstring, hv)
119119 else throwIO NonHttp
120120 _ -> throwIO $ BadFirstLine $ B.unpack s
121−{-# INLINE parseFirst #-} -- FIXME is this inline necessary? the function is only called from one place and not exported
122121
123122parseHeaderNoAttr :: ByteString -> H.Header
124123parseHeaderNoAttr s =
@@ -134,6 +133,7 @@ data THStatus = THStatus
134133 BSEndoList -- previously parsed lines
135134 BSEndo -- bytestrings to be prepended
136135
136+{-# INLINE takeHeaders #-}
137137takeHeaders :: Sink ByteString (ResourceT IO) [ByteString]
138138takeHeaders =
139139 await >>= maybe (throwIO ConnectionClosedByPeer) (push (THStatus 0 id id))
@@ -199,12 +199,11 @@ takeHeaders =
199199 let c = S.index bs (nl + 1)
200200 in Just (nl, c == 32 || c == 9)
201201 else Just (nl, False)
202−{-# INLINE takeHeaders #-}
203202
203+{-# INLINE checkCR #-}
204204checkCR :: ByteString -> Int -> Int
205205checkCR bs pos =
206206 let !p = pos - 1
207207 in if '\r' == B.index bs p
208208 then p
209209 else pos
210−{-# INLINE checkCR #-}