anchor.diff:        (let ((s (foreign-string-to-lisp err)))
           (leveldb-free err)
           (error 'leveldb-error :message s)))))
  +
  +(defmacro with-write-options ((var &key sync) &body forms)
  +  `(let ((,var (leveldb-writeoptions-create)))
  +     (unwind-protect
  +          (progn
  +            (leveldb-writeoptions-set-sync ,var ,sync)
  +            ,@forms)
  +       (leveldb-writeoptions-destroy ,var))))
   
   (defmacro with-octets-buffer ((var vector) &body forms)
     #+sbcl
  
positive.code:                     (null-pointer-p (mem-ref errptr :pointer)))
                 (make-instance 'db
                                :open-options open-options
                                :write-options write-options
                                :read-options read-options
                                :cache cache
                                :handle handle
                                :name name))
                (t (leveldb-readoptions-destroy read-options)
                   (leveldb-writeoptions-destroy write-options)
                   (leveldb-options-destroy open-options)
                   (when cache
                     (leveldb-cache-destroy cache))
  
negative.code:     (when handle
        (leveldb-close handle)
        (leveldb-readoptions-destroy (db-read-options db))
        (leveldb-options-destroy (db-open-options db))
        (when (db-cache db)
          (leveldb-cache-destroy (db-cache db))
          (setf (db-cache db) nil))
        (setf (db-handle db) nil)
        (setf (db-read-options db) nil)
        (setf (db-open-options db) nil))))
  
  (defun put (db key val &key sync)
    (with-octets-buffer (fkey key)
      (with-octets-buffer (fval val)
        (with-errptr (errptr)
          (with-write-options (options :sync sync)
            (leveldb-put (db-handle db) options
                         fkey (length key)
                         fval (length val)
                         errptr)
            (check-errptr errptr))))))
  
  (defun puts (db key val &key sync)
    (put db (string-to-octets key) (string-to-octets val) :sync sync))
  
  (defun delete (db key &key sync)
    (with-octets-buffer (fkey key)
      (with-errptr (errptr)
        (with-write-options (options :sync sync)
          (leveldb-delete (db-handle db) options
                          fkey (length key)
                          errptr)
          (check-errptr errptr)))))
  
  (defun deletes (db key &key sync)
    (delete db (string-to-octets key) :sync sync))
  
  (defun get (db key)
    (with-octets-buffer (fkey key)
  