diff options
author | Joey Hess <joeyh@joeyh.name> | 2015-04-19 00:38:29 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2015-04-19 00:38:29 -0400 |
commit | c5910fd179d374f644ab3c843b243a51a7df9b24 (patch) | |
tree | 9623da2ab0411f3862d415a17be7be567688b714 /Utility | |
parent | bf1bf600fc94f6b95d5723473b148b35ab32073d (diff) |
removed all uses of undefined from code base
It's a code smell, can lead to hard to diagnose error messages.
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/DirWatcher.hs | 10 | ||||
-rw-r--r-- | Utility/Directory.hs | 2 | ||||
-rw-r--r-- | Utility/FileMode.hs | 2 | ||||
-rw-r--r-- | Utility/Metered.hs | 2 | ||||
-rw-r--r-- | Utility/Touch.hsc | 6 |
5 files changed, 11 insertions, 11 deletions
diff --git a/Utility/DirWatcher.hs b/Utility/DirWatcher.hs index 3d3c14619..bde710626 100644 --- a/Utility/DirWatcher.hs +++ b/Utility/DirWatcher.hs @@ -57,7 +57,7 @@ eventsCoalesce = False #if (WITH_KQUEUE || WITH_FSEVENTS) eventsCoalesce = True #else -eventsCoalesce = undefined +eventsCoalesce = error "eventsCoalesce not defined" #endif #endif @@ -78,7 +78,7 @@ closingTracked = True #if WITH_KQUEUE closingTracked = False #else -closingTracked = undefined +closingTracked = error "closingTracked not defined" #endif #endif @@ -93,7 +93,7 @@ modifyTracked = True #if WITH_KQUEUE modifyTracked = False #else -modifyTracked = undefined +modifyTracked = error "modifyTracked not defined" #endif #endif @@ -131,7 +131,7 @@ watchDir dir prune scanevents hooks runstartup = #else type DirWatcherHandle = () watchDir :: FilePath -> Pruner -> Bool -> WatchHooks -> (IO () -> IO ()) -> IO DirWatcherHandle -watchDir = undefined +watchDir = error "watchDir not defined" #endif #endif #endif @@ -150,7 +150,7 @@ stopWatchDir = FSEvents.eventStreamDestroy #if WITH_WIN32NOTIFY stopWatchDir = Win32Notify.killWatchManager #else -stopWatchDir = undefined +stopWatchDir = error "stopWatchDir not defined" #endif #endif #endif diff --git a/Utility/Directory.hs b/Utility/Directory.hs index 85ec8bf45..2e037fdda 100644 --- a/Utility/Directory.hs +++ b/Utility/Directory.hs @@ -111,7 +111,7 @@ moveFile src dest = tryIO (rename src dest) >>= onrename -- But, mv will move into a directory if -- dest is one, which is not desired. whenM (isdir dest) rethrow - viaTmp mv dest undefined + viaTmp mv dest "" where rethrow = throwM e mv tmp _ = do diff --git a/Utility/FileMode.hs b/Utility/FileMode.hs index 5c4001ed8..f98e1bc87 100644 --- a/Utility/FileMode.hs +++ b/Utility/FileMode.hs @@ -124,7 +124,7 @@ withUmask _ a = a #endif combineModes :: [FileMode] -> FileMode -combineModes [] = undefined +combineModes [] = 0 combineModes [m] = m combineModes (m:ms) = foldl unionFileModes m ms diff --git a/Utility/Metered.hs b/Utility/Metered.hs index f94b5d121..c34e931a4 100644 --- a/Utility/Metered.hs +++ b/Utility/Metered.hs @@ -144,7 +144,7 @@ defaultChunkSize :: Int defaultChunkSize = 32 * k - chunkOverhead where k = 1024 - chunkOverhead = 2 * sizeOf (undefined :: Int) -- GHC specific + chunkOverhead = 2 * sizeOf (1 :: Int) -- GHC specific data OutputHandler = OutputHandler { quietMode :: Bool diff --git a/Utility/Touch.hsc b/Utility/Touch.hsc index f87bb62d6..c3318e6da 100644 --- a/Utility/Touch.hsc +++ b/Utility/Touch.hsc @@ -54,8 +54,8 @@ instance Storable TimeSpec where -- use the larger alignment of the two types in the struct alignment _ = max sec_alignment nsec_alignment where - sec_alignment = alignment (undefined::CTime) - nsec_alignment = alignment (undefined::CLong) + sec_alignment = alignment (1::CTime) + nsec_alignment = alignment (1::CLong) sizeOf _ = #{size struct timespec} peek ptr = do sec <- #{peek struct timespec, tv_sec} ptr @@ -92,7 +92,7 @@ touchBoth file atime mtime follow = -} instance Storable TimeSpec where - alignment _ = alignment (undefined::CLong) + alignment _ = alignment (1::CLong) sizeOf _ = #{size struct timeval} peek ptr = do sec <- #{peek struct timeval, tv_sec} ptr |