minor optimisation
avoid repeated scan of the same bytestring
This commit is contained in:
parent
61af9d8f63
commit
ddf6973d22
1 changed files with 2 additions and 1 deletions
|
@ -563,7 +563,7 @@ keyFile = fromRawFilePath . keyFile'
|
||||||
keyFile' :: Key -> RawFilePath
|
keyFile' :: Key -> RawFilePath
|
||||||
keyFile' k =
|
keyFile' k =
|
||||||
let b = serializeKey' k
|
let b = serializeKey' k
|
||||||
in if any (`S8.elem` b) ['&', '%', ':', '/']
|
in if S8.any (`elem` ['&', '%', ':', '/']) b
|
||||||
then S8.concatMap esc b
|
then S8.concatMap esc b
|
||||||
else b
|
else b
|
||||||
where
|
where
|
||||||
|
@ -573,6 +573,7 @@ keyFile' k =
|
||||||
esc '/' = "%"
|
esc '/' = "%"
|
||||||
esc c = S8.singleton c
|
esc c = S8.singleton c
|
||||||
|
|
||||||
|
|
||||||
{- Reverses keyFile, converting a filename fragment (ie, the basename of
|
{- Reverses keyFile, converting a filename fragment (ie, the basename of
|
||||||
- the symlink target) into a key. -}
|
- the symlink target) into a key. -}
|
||||||
fileKey :: FilePath -> Maybe Key
|
fileKey :: FilePath -> Maybe Key
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue