-(defun check-for-recursive-read (recursive-p operator-name)
- (when (and recursive-p
- (not (and (boundp '*read-buffer*)
- (boundp '*read-buffer-length*)
- (boundp '*ouch-ptr*)
- (boundp '*inch-ptr*))))
- (error 'simple-reader-error
- :format-control "~A was invoked with RECURSIVE-P being true outside ~
- of a recursive read operation."
- :format-arguments `(,operator-name))))
-
+(declaim (inline read-buffer-boundp))
+(defun read-buffer-boundp ()
+ (and (boundp '*read-buffer*)
+ (boundp '*ouch-ptr*)
+ (boundp '*inch-ptr*)))
+
+(defun check-for-recursive-read (stream recursive-p operator-name)
+ (when (and recursive-p (not (read-buffer-boundp)))
+ (simple-reader-error
+ stream
+ "~A was invoked with RECURSIVE-P being true outside ~
+ of a recursive read operation."
+ `(,operator-name))))