(defun cbuffer-ensure-size (buf size &key (load-factor 3/4)) (let ((length (cbuffer-length buf)) (new-size (round (* size (1+ load-factor))))) (if (< length new-size) (cbuffer-resize buf new-size) buf) (setf (cbuffer-size buf) size)))