flaw-lmdb/Flaw/Data/Lmdb.hs
Redundant do Open
Open
iteration z r = do
-- if we got key-value pair
if r == MDB_SUCCESS then do
-- get key
keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
- Read upRead up
- Exclude checks
Found
do if r == MDB_SUCCESS then
do keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
keyPtr <- peekElemOff keyBufPtr 1
key <- B.packCStringLen (keyPtr, keyLength)
if B.isPrefixOf keyPrefix key then
do valueLength <- fromIntegral . ptrToIntPtr <$> peek valueBufPtr
valuePtr <- peekElemOff valueBufPtr 1
value <- B.packCStringLen (valuePtr, valueLength)
(continue, nz) <- step key value z
if continue then
iteration nz =<<
mdb_cursor_get cursorPtr keyBufPtr valueBufPtr MDB_NEXT
else return nz
else return z
else if r == MDB_NOTFOUND then return z else lmdbThrowError r
Perhaps
if r == MDB_SUCCESS then
do keyLength <- fromIntegral . ptrToIntPtr <$> peek keyBufPtr
keyPtr <- peekElemOff keyBufPtr 1
key <- B.packCStringLen (keyPtr, keyLength)
if B.isPrefixOf keyPrefix key then
do valueLength <- fromIntegral . ptrToIntPtr <$> peek valueBufPtr
valuePtr <- peekElemOff valueBufPtr 1
value <- B.packCStringLen (valuePtr, valueLength)
(continue, nz) <- step key value z
if continue then
iteration nz =<<
mdb_cursor_get cursorPtr keyBufPtr valueBufPtr MDB_NEXT
else return nz
else return z
else if r == MDB_NOTFOUND then return z else lmdbThrowError r
Use camelCase Open
Open
data MDB_cursor
- Read upRead up
- Exclude checks
Found
data MDB_cursor
Perhaps
data MDBCursor
Use camelCase Open
Open
type MDB_dbi = CUInt
- Read upRead up
- Exclude checks
Found
type MDB_dbi = CUInt
Perhaps
type MDBDbi = CUInt
Use camelCase Open
Open
type MDB_val = Ptr CChar
- Read upRead up
- Exclude checks
Found
type MDB_val = Ptr CChar
Perhaps
type MDBVal = Ptr CChar