chiark / gitweb /
Comment out code removed, updated to new reference api
[clg] / glib / gparam.lisp
index 8af8db1008fa5c8d17edc9550e84fa02e3e3f545..cb7508655a58a33eb054dae173f09823fc18c09c 100644 (file)
@@ -20,7 +20,7 @@
 ;; TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
 ;; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
-;; $Id: gparam.lisp,v 1.19 2006/02/06 18:12:19 espen Exp $
+;; $Id: gparam.lisp,v 1.20 2006/02/15 09:55:50 espen Exp $
 
 (in-package "GLIB")
 
@@ -77,15 +77,12 @@ (defbinding (gvalue-p "g_type_check_value") () boolean
   (location pointer))
 
 (defmacro with-gvalue ((gvalue &optional type (value nil value-p)) &body body)
-  `(let ((,gvalue ,(cond
-                   ((and type value-p) `(gvalue-new ,type ,value))
-                   (type `(gvalue-new ,type))
-                   (`(gvalue-new)))))
-    (unwind-protect
-        (progn
-          ,@body
-          ,(unless value-p `(gvalue-get ,gvalue)))
-      (gvalue-free ,gvalue))))
+  `(with-allocated-memory (,gvalue +gvalue-size+)
+     ,(cond
+       ((and type value-p) `(gvalue-init ,gvalue ,type ,value))
+       (type `(gvalue-init ,gvalue ,type)))
+     ,@body
+     ,(unless value-p `(gvalue-get ,gvalue))))
 
 
 (deftype param-flag-type ()