a)
(define-integrable (accum->string a)
- (set-string-maximum-length! (car a) (cdr a))
- (car a))
+ (string-head! (car a) (cdr a)))
(define-integrable (accum-count a)
(cdr a))
(define (escape-pgsql-string string)
(guarantee-pgsql-available)
- (let* ((escaped (make-string (fix:* 2 (string-length string))))
- (length (pq-escape-string string escaped)))
- (set-string-maximum-length! escaped length)
- escaped))
+ (let ((escaped (make-string (fix:* 2 (string-length string)))))
+ (string-head! escaped (pq-escape-string string escaped))))
(define (encode-pgsql-bytea bytes)
(guarantee-pgsql-available)
(define (narrow-out/extract-output! port)
(let* ((os (port/state port))
- (string (ostate-buffer os)))
- (set-string-maximum-length! string (ostate-index os))
+ (string (ostate-buffer os))
+ (length (ostate-index os)))
(reset-buffer! os)
- string))
+ (string-head! string length)))
(define (make-wide-output-type)
(make-string-out-type wide-out/write-char
(define (octets-out/extract-output! port)
(output-port/flush-output port)
(let* ((os (output-octets-port/os port))
- (octets (ostate-buffer os)))
- (set-string-maximum-length! octets (ostate-index os))
+ (octets (ostate-buffer os))
+ (length (ostate-index os)))
(set-ostate-buffer! os (make-vector-8b 16))
(set-ostate-index! os 0)
- octets))
+ (string-head! octets length)))
(define (octets-out/position port)
(output-port/flush-output port)