X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=base%2Futils.lisp;h=d409977d1ef87c568e4a259324db0db0156165fb;hb=c4da3cfcbb955395d8a556e1f89aadad696302b7;hp=3f9ad8a6348862c3dce8723b4cd5dee1d80db835;hpb=67e6b9eaab9c9bcf8b57cbd476581437e4876b26;p=clsql.git diff --git a/base/utils.lisp b/base/utils.lisp index 3f9ad8a..d409977 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,11 +113,12 @@ (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 - (append (delimited-string-to-list (subseq str 0 at-pos) #\/) - (list (subseq str (1+ at-pos))))) + (cons (subseq str (1+ at-pos)) + (delimited-string-to-list (subseq str 0 at-pos) #\/))) (t (delimited-string-to-list str #\/))))) +