[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[no subject]



Actually, you're right about needing an UNWIND-PROTECT, but
you're example doesn't do it, because an abort may happen
between the binding of VAR and the unwind-protect.

	(defmacro with-temp-bitmap ((var . limits) &body body)
	   `(let ((,var (make-bitmap ., limits)))
here--------->
	      (unwind-protect
		(progn ., body)
		(when ,var
		  (dispose-record (prog1 ,var (setq ,var nil)))))))

This is what you want:

	(defmacro with-temp-bitmap ((var . limits) &body body)
	   `(let ((,var nil))
	      (unwind-protect
		(progn 
		  (setq ,var (make-bitmap ., limits))
		  . ,body)
		(when ,var
		  (dispose-record ,var)))))


-dmg

(BTW, as a matter of style, the commas in a back-quoted lists
go with the expression they unquote, so:

	(x . ,y) makes more sense than (x ., y)

Also, 

o Use &REST instead of dotting your defmacro arglist
o Don't need to SETQ var after disposing of the record
  since you have no further references to the variable
  and at this point, you're not going to let the user
  reference it anymore.