Changeset 30231 in project


Ignore:
Timestamp:
12/28/13 17:22:52 (6 years ago)
Author:
sjamaan
Message:

postgresql: Use unsafe accessors in high-level fold/for-each etc (we already know the size there so no invalid indices are passed)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/postgresql/trunk/postgresql.scm

    r30227 r30231  
    662662  (value-at* result column row raw: raw))
    663663
    664 (define (row-values result #!optional (row 0) #!key raw)
    665   (check-row-index! result row 'row)
     664(define (row-values* result row #!key raw)
    666665  (let loop ((list '())
    667666             (column (column-count result)))
     
    671670              (sub1 column)))))
    672671
    673 (define (column-values result #!optional (column 0) #!key raw)
    674   (check-column-index! result column 'column)
     672(define (row-values result #!optional (row 0) #!key raw)
     673  (check-row-index! result row 'row)
     674  (row-values* result row raw: raw))
     675
     676(define (column-values* result column #!key raw)
    675677  (let loop ((list '())
    676678             (row (row-count result)))
     
    679681        (loop (cons (value-at* result column (sub1 row) raw: raw) list)
    680682              (sub1 row)))))
     683
     684(define (column-values result #!optional (column 0) #!key raw)
     685  (check-column-index! result column 'column)
     686  (column-values* result column raw: raw))
    681687
    682688;; (define (row-alist result #!optional (row 0) #!key raw)
     
    12311237           (loop (kons (extract-item result item) seed) (add1 item)))))))
    12321238
    1233 (define row-fold (make-result-fold row-count row-values))
     1239(define row-fold (make-result-fold row-count row-values*))
    12341240(define (row-fold* kons knil result)
    12351241  (row-fold (lambda (values seed)
    12361242              (apply kons (append values (list seed)))) knil result))
    12371243
    1238 (define column-fold (make-result-fold column-count column-values))
     1244(define column-fold (make-result-fold column-count column-values*))
    12391245(define (column-fold* kons knil result)
    12401246  (column-fold (lambda (values seed)
     
    12501256          (loop (kons (extract-item result (sub1 item)) seed) (sub1 item))))))
    12511257
    1252 (define row-fold-right (make-result-fold-right row-count row-values))
     1258(define row-fold-right (make-result-fold-right row-count row-values*))
    12531259(define (row-fold-right* kons knil result)
    12541260  (row-fold-right (lambda (values seed)
    12551261                    (apply kons (append values (list seed)))) knil result))
    12561262
    1257 (define column-fold-right (make-result-fold-right column-count column-values))
     1263(define column-fold-right (make-result-fold-right column-count column-values*))
    12581264(define (column-fold-right* kons knil result)
    12591265  (column-fold-right (lambda (values seed)
Note: See TracChangeset for help on using the changeset viewer.