X-Git-Url: http://git.kpe.io/?p=clsql.git;a=blobdiff_plain;f=base%2Futils.lisp;fp=base%2Futils.lisp;h=729109bd1ad98ed5ae21bcd24170414b738e5948;hp=3f9ad8a6348862c3dce8723b4cd5dee1d80db835;hb=afa1e8481ca62ee15952c695fd04c8601b65b218;hpb=67e6b9eaab9c9bcf8b57cbd476581437e4876b26 diff --git a/base/utils.lisp b/base/utils.lisp index 3f9ad8a..729109b 100644 --- a/base/utils.lisp +++ b/base/utils.lisp @@ -81,6 +81,15 @@ 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." @@ -104,7 +113,7 @@ (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 @@ -112,3 +121,4 @@ (list (subseq str (1+ at-pos))))) (t (delimited-string-to-list str #\/))))) +