Improved the fasta parser for better memory handling and better parsing

of the last parts of fasta headers (definitions)
This commit is contained in:
Celine Mercier
2017-10-13 18:54:17 +02:00
parent 52e94bbea7
commit a258d334b1
5 changed files with 83 additions and 84 deletions

View File

@ -76,7 +76,7 @@ element_from_header** check_and_realloc_mem_in_header_table(element_from_header*
{
(*nbf)++;
if (*nbf == *memory_allocated)
if ((*nbf)+1 == *memory_allocated)
{
(*memory_allocated)++;
*p_header = (element_from_header*) realloc(*p_header, (*memory_allocated) * sizeof(element_from_header));
@ -87,7 +87,6 @@ element_from_header** check_and_realloc_mem_in_header_table(element_from_header*
void end_header_table(element_from_header** p_header, int nbf)
{
nbf = nbf - 1;
//fprintf(stderr, "nbf = %d", nbf);
*p_header = (element_from_header*) realloc(*p_header, nbf * sizeof(element_from_header));
sprintf((*p_header)->value, "%d", nbf);
}