moved buf_splice() into its own file