fixed type-dec on substitute-string-for-char so that nil arg value returns nil as...
authorRuss Tyndall <russ@acceleration.net>
Thu, 7 Jul 2011 18:41:17 +0000 (14:41 -0400)
committerRuss Tyndall <russ@acceleration.net>
Thu, 7 Jul 2011 18:41:17 +0000 (14:41 -0400)
sql/utils.lisp

index 6e4230d84d94486d8448cc9c84f9c89839bd47e4..d5b31ed4fd1678862294132dfd7bee98e95c6ee8 100644 (file)
   (substitute-string-for-char s #\' "''"))
 
 (defun substitute-string-for-char (procstr match-char subst-str)
-"Substitutes a string for a single matching character of a string"
-  (declare (type string procstr))
-  (let ((pos (position match-char procstr)))
-    (if pos
-        (concatenate 'string
-          (subseq procstr 0 pos) subst-str
-          (substitute-string-for-char
-           (subseq procstr (1+ pos)) match-char subst-str))
-      procstr)))
+  "Substitutes a string for a single matching character of a string"
+  (when procstr
+    (locally
+        (declare (type string procstr))
+      (let ((pos (position match-char procstr)))
+        (if pos
+            (concatenate 'string
+                         (subseq procstr 0 pos) subst-str
+                         (substitute-string-for-char
+                          (subseq procstr (1+ pos)) match-char subst-str))
+            procstr)))))
 
 
 (defun position-char (char string start max)