[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [tordnsel/master] drop Util.splitByDelimiter
commit 143df1edcb7f54ebe3e9d61e0f9b2a7654e5d464
Author: David Kaloper <david@xxxxxxxx>
Date: Wed Oct 16 18:57:22 2013 +0200
drop Util.splitByDelimiter
---
.gitignore | 1 +
src/TorDNSEL/Util.hsc | 15 +--------------
2 files changed, 2 insertions(+), 14 deletions(-)
diff --git a/.gitignore b/.gitignore
index 84ca43d..87cfc48 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
dist/
+local/
.cabal-sandbox/
cabal.sandbox.config
diff --git a/src/TorDNSEL/Util.hsc b/src/TorDNSEL/Util.hsc
index 51c7664..f866eb9 100644
--- a/src/TorDNSEL/Util.hsc
+++ b/src/TorDNSEL/Util.hsc
@@ -1,7 +1,5 @@
{-# LANGUAGE ForeignFunctionInterface, OverlappingInstances, UndecidableInstances #-}
-{-# OPTIONS_GHC -fno-warn-type-defaults -fno-warn-orphans -Wwarn #-}
--- ^^^^^^
--- XXX: findSubstrings is deprecated
+{-# OPTIONS_GHC -fno-warn-type-defaults -fno-warn-orphans #-}
-----------------------------------------------------------------------------
-- |
@@ -63,7 +61,6 @@ module TorDNSEL.Util (
, inBoundsOf
, htonl
, ntohl
- , splitByDelimiter
, showUTCTime
-- * Conduit utilities
@@ -429,16 +426,6 @@ frameC delim = loop $ B.pack "" where
(h, t) | B.null t -> loop h
| otherwise -> h <$ C.leftover (B.drop (B.length delim) t)
--- | Split @bs@ into pieces delimited by @delimiter@, consuming the delimiter.
--- The result for overlapping delimiters is undefined.
-splitByDelimiter :: ByteString -> ByteString -> [ByteString]
-splitByDelimiter delimiter bs = subst (-len : B.findSubstrings delimiter bs)
- where
- subst (x:xs@(y:_)) = B.take (y-x-len) (B.drop (x+len) bs) : subst xs
- subst [x] = [B.drop (x+len) bs]
- subst [] = error "splitByDelimiter: empty list"
- len = B.length delimiter
-
-- | Convert a 'UTCTime' to a string in ISO 8601 format.
showUTCTime :: UTCTime -> String
showUTCTime time = printf "%s %02d:%02d:%s" date hours mins secStr'
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits