r8918: add missing function
[clsql.git] / base / utils.lisp
index 3f9ad8a6348862c3dce8723b4cd5dee1d80db835..729109bd1ad98ed5ae21bcd24170414b738e5948 100644 (file)
       procstr)))
 
 
+(defun position-char (char string start max)
+  "From KMRCL."
+  (declare (optimize (speed 3) (safety 0) (space 0))
+          (fixnum start max) (simple-string string))
+  (do* ((i start (1+ i)))
+       ((= i max) nil)
+    (declare (fixnum i))
+    (when (char= char (schar string i)) (return i))))
+
 (defun delimited-string-to-list (string &optional (separator #\space) 
                                                  skip-terminal)
   "Split a string with delimiter, from KMRCL."
     (setq pos (1+ end))))
 
 (defun string-to-list-connection-spec (str)
-  (let ((at-pos (position #\@ str)))
+  (let ((at-pos (position-char #\@ str)))
     (cond
       ((and at-pos (> (length str) at-pos))
        ;; Connection spec is SQL*NET format
               (list (subseq str (1+ at-pos)))))
       (t
        (delimited-string-to-list str #\/)))))
+