- (let ((new-element (ecase (alien-type type)
- (system-area-pointer #'%gslist-prepend-sap)
- ((signed-byte c-call:short c-call:int c-call:long)
- #'%gslist-prepend-signed)
- ((unsigned-byte c-call:unsigned-short
- c-call:unsigned-int c-call:unsigned-long)
- #'%gslist-prepend-unsigned)))
- (to-alien (to-alien-function type)))
- (loop
- for element in (reverse list)
- as gslist = (funcall new-element (or gslist (make-pointer 0))
- (funcall to-alien element))
- finally (return gslist))))
+ (loop
+ with writer = (writer-function type)
+ for element in (reverse list)
+ as gslist = (%gslist-prepend (or gslist (make-pointer 0)))
+ do (funcall writer element gslist)
+ finally (return gslist)))