Example #1
0
static int store_in_sa_collection(void *data, GthSA *sa,
                                  GT_UNUSED const char *outputfilename,
                                  GT_UNUSED GtError *err)
{
  SACollectionData *sa_collection_data = (SACollectionData*) data;
  bool inserted;
  inserted = gth_sa_collection_insert_sa(sa_collection_data->sa_collection, sa,
                                         sa_collection_data->sa_filter,
                                         sa_collection_data->stat);
  if (!inserted) { /* unsuccessful insertion; discard sa */
    gth_sa_delete(sa);
  }
  return 0;
}
/* the following function saves <sa> by inserting it into <sa_collection> and
   sets <significantmatchfound> to true, if the insertion was successful */
static void save_sa(GthSACollection *sa_collection, GthSA *sa,
                    GthSAFilter *sa_filter, GthMatchInfo *match_info,
                    GthStat *stat)
{
  if (!gth_sa_collection_insert_sa(sa_collection, sa, sa_filter, stat)) {
    /* unsuccessful insertion; discard sa */
    gth_sa_delete(sa);
    match_info->call_number--;
  }
  else {
    /* else successful insertion */
    match_info->significant_match_found = true;
  }
}