X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=db-oracle%2Fforeign-resources.lisp;h=fe6986b5b0c51d006a84d15b2d125ce2afe55528;hp=5f66948c8805054c9771968cac12a2f2e8079cd1;hb=refs%2Ftags%2Fv3.8.6;hpb=39bc32836bdf5bdab576ba1e4ef3762f46000b98 diff --git a/db-oracle/foreign-resources.lisp b/db-oracle/foreign-resources.lisp index 5f66948..fe6986b 100644 --- a/db-oracle/foreign-resources.lisp +++ b/db-oracle/foreign-resources.lisp @@ -2,8 +2,6 @@ ;;;; ************************************************************************* ;;;; FILE IDENTIFICATION ;;;; -;;;; Name: alien-resources.lisp -;;;; ;;;; $Id$ ;;;; ;;;; This file is part of CLSQL. @@ -19,36 +17,36 @@ (defstruct (foreign-resource) (type (error "Missing TYPE.") - :read-only t) + :read-only t) (sizeof (error "Missing SIZEOF.") - :read-only t) + :read-only t) (buffer (error "Missing BUFFER.") - :read-only t) + :read-only t) (in-use nil :type boolean)) (defun %get-resource (type sizeof) (let ((resources (gethash type *foreign-resource-hash*))) (car (member-if - #'(lambda (res) - (and (= (foreign-resource-sizeof res) sizeof) - (not (foreign-resource-in-use res)))) - resources)))) + #'(lambda (res) + (and (= (foreign-resource-sizeof res) sizeof) + (not (foreign-resource-in-use res)))) + resources)))) (defun %insert-foreign-resource (type res) (let ((resource (gethash type *foreign-resource-hash*))) (setf (gethash type *foreign-resource-hash*) - (cons res (gethash type *foreign-resource-hash*))))) + (cons res resource)))) (defmacro acquire-foreign-resource (type &optional size) - `(let ((res (%get-resource ',type ,size))) + `(let ((res (%get-resource ,type ,size))) (unless res (setf res (make-foreign-resource - :type ',type :sizeof ,size - :buffer (uffi:allocate-foreign-object ,type ,size))) + :type ,type :sizeof ,size + :buffer (uffi:allocate-foreign-object ,type ,size))) (%insert-foreign-resource ',type res)) (claim-foreign-resource res))) - + (defun free-foreign-resource (ares) (setf (foreign-resource-in-use ares) nil) ares)