src/atsc3_utils.c
block_t* block_Duplicate(block_t* src) {
	if(!__block_check_bounaries(__FUNCTION__, src)) return NULL;

	uint32_t to_alloc_size = src->p_size;

	block_t* dest = block_Alloc(to_alloc_size);
	memcpy(dest->p_buffer, src->p_buffer, to_alloc_size);
	dest->i_pos = src->i_pos;

	return dest;
}
/**
 * note, this will duplicate the full block size and update i_pos in the dest payload
 * if you need a head trimmed version of the payload at i_pos, use block_Duplicate_from_position
 * if you need a tail trimmed version of the payload N bytes long, block_Duplicate_to_size
 */
note, this will duplicate the full block size and update i_pos in the dest payload
if you need a head trimmed version of the payload at i_pos, use block_Duplicate_from_position
if you need a tail trimmed version of the payload N bytes long, block_Duplicate_to_size
note this will duplicate the full block size and update i_pos in the dest payload if you need a head trimmed version of the payload at i_pos use block_Duplicate_from_position if you need a tail trimmed version of the payload N bytes long block_Duplicate_to_size
block_t* block_Duplicate(block_t* src) {
	if(!__block_check_bounaries(__FUNCTION__, src)) return NULL;
	uint32_t to_alloc_size = src->p_size;
	block_t* dest = block_Alloc(to_alloc_size);
	memcpy(dest->p_buffer, src->p_buffer, to_alloc_size);
	dest->i_pos = src->i_pos;
	return dest;
}
block_t * block_Duplicate ( block_t * src ) { if ( ! __block_check_bounaries ( __FUNCTION__ , src ) ) return NULL ; uint32_t to_alloc_size = src -> p_size ; block_t * dest = block_Alloc ( to_alloc_size ) ; memcpy ( dest -> p_buffer , src -> p_buffer , to_alloc_size ) ; dest -> i_pos = src -> i_pos ; return dest ; }
note, this will duplicate the full block size and update i_pos in the dest payload
 if you need a head trimmed version of the payload at i_pos, use block_Duplicate_from_position
 if you need a tail trimmed version of the payload N bytes long, block_Duplicate_to_size
note this will duplicate the full block size and update i_pos in the dest payload if you need a head trimmed version of the payload at i_pos use block_Duplicate_from_position if you need a tail trimmed version of the payload N bytes long block_Duplicate_to_size