From d1eb39dc647cfa001e2476c10167de7d9140e78c Mon Sep 17 00:00:00 2001 From: Stas Boukarev Date: Fri, 26 Apr 2024 05:45:27 +0300 Subject: [PATCH] Silence an unused variable warning. --- api.lisp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/api.lisp b/api.lisp index ba641f9..b542d4c 100644 --- a/api.lisp +++ b/api.lisp @@ -339,22 +339,23 @@ substrings may share structure with TARGET-STRING." (with-rebinding (target-string) (with-unique-names (match-start match-end reg-starts reg-ends start-index substr-fn) - (let ((var-bindings - (loop for (function var) in (normalize-var-list var-list) - for counter from 0 - when var - collect `(,var (let ((,start-index - (aref ,reg-starts ,counter))) - (if ,start-index - ,(if (equal function '#'parse-integer) - `(parse-integer ,target-string :start ,start-index - :end (aref ,reg-ends ,counter)) - `(funcall ,function - (funcall ,substr-fn + (let* (substr-needed + (var-bindings + (loop for (function var) in (normalize-var-list var-list) + for counter from 0 + when var + collect `(,var (let ((,start-index + (aref ,reg-starts ,counter))) + (if ,start-index + ,(if (equal function '#'parse-integer) + `(parse-integer ,target-string :start ,start-index + :end (aref ,reg-ends ,counter)) + `(funcall ,function + (funcall ,(setf substr-needed substr-fn) ,target-string ,start-index (aref ,reg-ends ,counter)))) - nil)))))) + nil)))))) `(multiple-value-bind (,match-start ,match-end ,reg-starts ,reg-ends) (scan ,regex ,target-string :start (or ,start 0) :end (or ,end (length ,target-string))) @@ -363,9 +364,9 @@ substrings may share structure with TARGET-STRING." `((declare (ignore ,reg-starts ,reg-ends)))) (when ,match-start ,@(if var-bindings - `((let* ,(list* - `(,substr-fn (if ,sharedp #'nsubseq #'subseq)) - var-bindings) + `((let* (,@(and substr-needed + `((,substr-fn (if ,sharedp #'nsubseq #'subseq)))) + ,@var-bindings) ,@body)) body)))))))