Moved some blob functions to obiblob.c
This commit is contained in:
69
src/obiavl.c
69
src/obiavl.c
@ -108,7 +108,8 @@ static char* build_avl_data_file_name(const char* avl_name);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Internal function returning the size of an AVL tree header on this platform.
|
||||
* @brief Internal function returning the size of an AVL tree header on this platform,
|
||||
* including the size of the bloom filter associated with the AVL tree.
|
||||
*
|
||||
* @returns The size of an AVL tree header in bytes.
|
||||
*
|
||||
@ -282,38 +283,6 @@ int add_new_avl_in_group(OBIDMS_avl_group_p avl_group);
|
||||
int maybe_in_avl(OBIDMS_avl_p avl, Obi_blob_p value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Internal function comparing two blobs.
|
||||
*
|
||||
* The encoding is compared first, then the length of the
|
||||
* values, then the values themselves.
|
||||
*
|
||||
* @param value_1 A pointer to the first blob structure.
|
||||
* @param value_2 A pointer to the second blob structure.
|
||||
*
|
||||
* @returns A value < 0 if value_1 < value_2,
|
||||
* a value > 0 if value_1 > value_2,
|
||||
* and 0 if value_1 == value_2.
|
||||
*
|
||||
* @since October 2015
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int blob_compare(Obi_blob_p value_1, Obi_blob_p value_2);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Internal function calculating the size in bytes of a blob.
|
||||
*
|
||||
* @param value A pointer to the blob structure.
|
||||
*
|
||||
* @returns The size of the blob in bytes.
|
||||
*
|
||||
* @since October 2015
|
||||
* @author Celine Mercier (celine.mercier@metabarcoding.org)
|
||||
*/
|
||||
int blob_sizeof(Obi_blob_p value);
|
||||
|
||||
|
||||
/**
|
||||
* @brief Internal function storing a value (blob) in the data array referred to by an AVL tree.
|
||||
*
|
||||
@ -986,40 +955,6 @@ int maybe_in_avl(OBIDMS_avl_p avl, Obi_blob_p value)
|
||||
}
|
||||
|
||||
|
||||
int blob_compare(Obi_blob_p value_1, Obi_blob_p value_2)
|
||||
{
|
||||
int comp;
|
||||
int32_t b;
|
||||
|
||||
if (value_1->element_size != value_2->element_size)
|
||||
return (value_1->element_size - value_2->element_size);
|
||||
|
||||
if (value_1->length_encoded_value != value_2->length_encoded_value)
|
||||
return (value_1->length_encoded_value - value_2->length_encoded_value);
|
||||
|
||||
if (value_1->element_size != ELEMENT_SIZE_STR) // because if so, length_decoded_value == length_encoded_value
|
||||
{
|
||||
if (value_1->length_decoded_value != value_2->length_decoded_value)
|
||||
return (value_1->length_decoded_value - value_2->length_decoded_value);
|
||||
}
|
||||
|
||||
b = 0;
|
||||
comp = 0;
|
||||
while (!comp && (b < value_1->length_encoded_value))
|
||||
{
|
||||
comp = *((value_1->value)+b) - *((value_2->value)+b);
|
||||
b++;
|
||||
}
|
||||
return comp;
|
||||
}
|
||||
|
||||
|
||||
int blob_sizeof(Obi_blob_p value)
|
||||
{
|
||||
return (sizeof(Obi_blob_t) + (value->length_encoded_value));
|
||||
}
|
||||
|
||||
|
||||
index_t avl_add_value_in_data_array(OBIDMS_avl_p avl, Obi_blob_p value)
|
||||
{
|
||||
index_t value_idx;
|
||||
|
Reference in New Issue
Block a user