[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)))
		(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))
		  (setq ,var (make-bitmap ., limits))
		  . ,body)
		(when ,var
		  (dispose-record ,var)))))


(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)


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.