Removing odbc::%cstring-into-vector -- unused and unreliable.
authorNathan Bird <nathan@acceleration.net>
Fri, 6 Jan 2012 21:39:09 +0000 (16:39 -0500)
committerNathan Bird <nathan@acceleration.net>
Fri, 6 Jan 2012 21:43:40 +0000 (16:43 -0500)
The idea of the function was to copy out of c string memory into a
lisp string a byte at a time, converting to lisp characters as we go.

However:
 * this doesn't work with multibyte charsets
 * the underlying deref-array funcall would sometimes pull the entire
   array into lisp to then get at the single element-- for each element.
 * set elements in the lisp array using schar but there's no guarantee
   that the lisp array is a simple-string. Newer SBCL's err on this.

db-odbc/odbc-api.lisp

index fe9d6f80a73ef13350f4e44bce9a0eda33c86a39..208dafa7536190665644a5709ad9fb99f04eb81b 100644 (file)
@@ -48,21 +48,6 @@ May be locally bound to something else if a certain type is necessary.")
                 (char-code (char ,string i))))
         (setf (deref-array char-ptr '(:array :byte) ,size) 0)))))
 
                 (char-code (char ,string i))))
         (setf (deref-array char-ptr '(:array :byte) ,size) 0)))))
 
-(defun %cstring-into-vector (ptr vector offset size-in-bytes)
-  (dotimes (i size-in-bytes)
-    (setf (schar vector offset)
-          (ensure-char-character
-              ;; this is MUCH faster than (sb-alien:deref ptr i) even though
-              ;; sb-alien:deref makes more sense. I snagged this by looking at
-              ;; cffi which we had used previously without this bug
-              #+(and sbcl (not cffi))
-              (sb-sys:sap-ref-8 (sb-alien:alien-sap ptr) i)
-              #-(and sbcl (not cffi))
-              (deref-array ptr '(:array :unsigned-char) i)
-       ))
-    (incf offset))
-  offset)
-
 (defmacro with-allocate-foreign-string ((var len) &body body)
   "Safely does uffi:allocate-foreign-string-- making sure we do the uffi:free-foreign-object"
   `(let ((,var))
 (defmacro with-allocate-foreign-string ((var len) &body body)
   "Safely does uffi:allocate-foreign-string-- making sure we do the uffi:free-foreign-object"
   `(let ((,var))