From: Dmitry Kalyanov Date: Wed, 25 Feb 2009 22:37:53 +0000 (+0300) Subject: Made (release nil) no-op instead of error. Added shorthand for using X-Git-Url: http://repo.macrolet.net/gitweb/?a=commitdiff_plain;h=c2c72d4bf4369bd02dc4491808a7ed59177f770e;p=cl-gtk2.git Made (release nil) no-op instead of error. Added shorthand for using --- diff --git a/glib/gobject.foreign.lisp b/glib/gobject.foreign.lisp index 79d010f..ce6d42f 100644 --- a/glib/gobject.foreign.lisp +++ b/glib/gobject.foreign.lisp @@ -2,13 +2,15 @@ (defgeneric release (object)) +(defmethod release ((object null))) + (defun release* (&rest objects) (declare (dynamic-extent objects)) (loop for object in objects do (release object))) -(defmacro using ((var expr) &body body) +(defmacro using ((var &optional (expr var)) &body body) `(let ((,var ,expr)) (unwind-protect (progn ,@body) @@ -16,7 +18,7 @@ (defun using-expand (bindings body) (if bindings - (destructuring-bind (var expr) (first bindings) + (destructuring-bind (var &optional (expr var)) (ensure-list (first bindings)) `(let ((,var ,expr)) (unwind-protect ,(using-expand (rest bindings) body)