aboutsummaryrefslogtreecommitdiff
path: root/src/property/file.lisp
diff options
context:
space:
mode:
Diffstat (limited to 'src/property/file.lisp')
-rw-r--r--src/property/file.lisp42
1 files changed, 20 insertions, 22 deletions
diff --git a/src/property/file.lisp b/src/property/file.lisp
index 4af2e27..a54d38c 100644
--- a/src/property/file.lisp
+++ b/src/property/file.lisp
@@ -439,25 +439,23 @@ not NO-SOURCE and the corresponding member of ENTRIES is STRING= to either
NO-SOURCE or \"PLACEHOLDER\", use the existing field value."
(let ((unknown (list no-source "PLACEHOLDER"))
(pending (make-hash-table :test #'equal)))
- (flet ((fields (entry)
- (remove "" (split-string entry) :test #'string=)))
- (dolist (entry entries)
- (setf (gethash (nth target (fields entry)) pending) entry))
- (map-file-lines
- file
- (lambda (lines)
- (loop for line in lines
- for line-fields = (fields line)
- for line-source = (nth source line-fields)
- and line-target = (nth target line-fields)
- for entry = (when-let* ((entry (gethash line-target pending))
- (fields (fields entry)))
- (when (and (member (nth source fields)
- unknown :test #'string=)
- (not (string= line-source no-source)))
- (setf (nth source fields) line-source))
- (format nil "~{~A~^ ~}" fields))
- if entry
- collect it into accum and do (remhash line-target pending)
- else collect line into accum
- finally (return (nconc accum (hash-table-values pending)))))))))
+ (dolist (entry entries)
+ (setf (gethash (nth target (words entry)) pending) entry))
+ (map-file-lines
+ file
+ (lambda (lines)
+ (loop for line in lines
+ for line-fields = (words line)
+ for line-source = (nth source line-fields)
+ and line-target = (nth target line-fields)
+ for entry = (when-let* ((entry (gethash line-target pending))
+ (fields (words entry)))
+ (when (and (member (nth source fields)
+ unknown :test #'string=)
+ (not (string= line-source no-source)))
+ (setf (nth source fields) line-source))
+ (format nil "~{~A~^ ~}" fields))
+ if entry
+ collect it into accum and do (remhash line-target pending)
+ else collect line into accum
+ finally (return (nconc accum (hash-table-values pending))))))))