(defun make-get-buffer (data) (let ((size (max (if data (cbuffer-size data) 0) 1024)) (buf (alloc-cbuffer))) (when (< (cbuffer-length buf) size) (cbuffer-resize buf size)) (when data (memcpy (cbuffer-data buf) (cbuffer-data data) (cbuffer-size data)) (setf (cbuffer-size buf) (cbuffer-size data))) buf))Source Context