- (if (< ptr max)
- (progn
- (setf (bref buffer ptr) code)
- (incf ptr))
- (progn
- (sc-flush-buffer stream t)
- (setf ptr (sm buffpos stream)))))))))
+ (unless (< ptr max)
+ ;; need to update buffpos before control leaves this
+ ;; function in any way
+ (setf (sm buffpos stream) ptr)
+ (sc-flush-buffer stream t)
+ (setf ptr (sm buffpos stream)))
+ (setf (bref buffer ptr) code)
+ (incf ptr))))))