projects
/
clsql.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Depend on UFFI version 2.x
[clsql.git]
/
db-oracle
/
foreign-resources.lisp
diff --git
a/db-oracle/foreign-resources.lisp
b/db-oracle/foreign-resources.lisp
index 8756f5843435842e445fc8456b4247404964bfa9..3344cb4bd12009f0ab62d9f817b76821263acab8 100644
(file)
--- a/
db-oracle/foreign-resources.lisp
+++ b/
db-oracle/foreign-resources.lisp
@@
-2,8
+2,6
@@
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
;;;; *************************************************************************
;;;; FILE IDENTIFICATION
;;;;
-;;;; $Id$
-;;;;
;;;; This file is part of CLSQL.
;;;;
;;;; CLSQL users are granted the rights to distribute and use this software
;;;; This file is part of CLSQL.
;;;;
;;;; CLSQL users are granted the rights to distribute and use this software
@@
-17,36
+15,36
@@
(defstruct (foreign-resource)
(type (error "Missing TYPE.")
(defstruct (foreign-resource)
(type (error "Missing TYPE.")
- :read-only t)
+
:read-only t)
(sizeof (error "Missing SIZEOF.")
(sizeof (error "Missing SIZEOF.")
- :read-only t)
+
:read-only t)
(buffer (error "Missing BUFFER.")
(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
(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*)
(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)
(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
(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)))
(%insert-foreign-resource ',type res))
(claim-foreign-resource res)))
-
+
(defun free-foreign-resource (ares)
(setf (foreign-resource-in-use ares) nil)
ares)
(defun free-foreign-resource (ares)
(setf (foreign-resource-in-use ares) nil)
ares)