Get rid of our own implementation of alexandria:read-file-into-string.

This commit is contained in:
Dimitri Fontaine 2014-10-01 23:23:46 +02:00
parent 2369a142a7
commit dfb1e9355a
4 changed files with 7 additions and 20 deletions

View File

@ -28,6 +28,7 @@
(defpackage #:pgloader.utils
(:use #:cl #:pgloader.params)
(:import-from #:alexandria #:read-file-into-string)
(:import-from #:pgloader.monitor
#:with-monitor
#:*monitoring-queue*
@ -134,6 +135,7 @@
;;;
(defpackage #:pgloader.ini
(:use #:cl #:pgloader.params #:pgloader.utils)
(:import-from #:alexandria #:read-file-into-string)
(:import-from #:pgloader.pgsql
#:list-columns
#:with-pgsql-transaction
@ -150,6 +152,7 @@
(defpackage #:pgloader.parser
(:use #:cl #:esrap #:pgloader.params #:pgloader.utils #:pgloader.sql)
(:import-from #:alexandria #:read-file-into-string)
(:import-from #:pgloader.pgsql
#:with-pgsql-transaction
#:pgsql-execute)

View File

@ -375,7 +375,7 @@
:type "sql"))
(sql-file-exists (probe-file sqlfile))
(sql-commands (when sql-file-exists
(slurp-file-into-string sqlfile))))
(read-file-into-string sqlfile))))
;; First
(if include-sql-file
(if sql-file-exists
@ -400,5 +400,5 @@
(merge-pathnames (params-filename params)
(directory-namestring filename))))
(format c "~%~%~%~%~a"
(slurp-file-into-string datafile))))))
(read-file-into-string datafile))))))
and collect target)))

View File

@ -2342,7 +2342,7 @@ load database
filename
(let ((*cwd* (directory-namestring filename))
(*data-expected-inline* nil)
(content (slurp-file-into-string filename)))
(content (read-file-into-string filename)))
(multiple-value-bind (commands end-commands-position)
(parse 'commands content :junk-allowed t)
@ -2460,7 +2460,7 @@ load database
collect
(cons filename
(ignore-errors
(parse-commands (slurp-file-into-string filename)))))))
(parse-commands (read-file-into-string filename)))))))
(defun list-failing-tests (&rest tests)
"Return the list of test files we can't parse."

View File

@ -43,22 +43,6 @@
q)
secs)))))
;;;
;;; File utils
;;;
(defun slurp-file-into-string (filename)
"Return given filename's whole content as a string."
(with-open-file (stream filename
:direction :input
:external-format :utf-8)
(let ((seq (make-array (file-length stream)
:element-type 'character
:fill-pointer t)))
;; apparently the fastest way at that is read-sequence
;; http://www.ymeme.com/slurping-a-file-common-lisp-83.html
(setf (fill-pointer seq) (read-sequence seq stream))
seq)))
;;;
;;; Camel Case converter
;;;