Beispiel #1
0
void *genericmaptable(const GtStr *indexname,
                      const char *suffix,
                      unsigned long expectedunits,
                      size_t sizeofunit,
                      GtError *err)
{
  size_t numofbytes;

  void *ptr = genericmaponlytable(indexname,suffix,&numofbytes,err);
  if (ptr == NULL)
  {
    return NULL;
  }
  if (checkmappedfilesize(indexname,suffix,
                          numofbytes,expectedunits,sizeofunit,err) != 0)
  {
    gt_fa_xmunmap(ptr);
    return NULL;
  }
  return ptr;
}
Beispiel #2
0
Pckbuckettable *mappckbuckettable(const GtStr *indexname,
                                  unsigned int numofchars,
                                  GtError *err)
{
  size_t numofbytes;
  void *mapptr;
  unsigned int maxdepth;
  Pckbuckettable *pckbt;

  gt_error_check(err);
  mapptr = genericmaponlytable(indexname,PCKBUCKETTABLE,&numofbytes,err);
  if (mapptr == NULL)
  {
    return NULL;
  }
  maxdepth = (unsigned int) ((Seqpos *) mapptr)[0];
  pckbt = allocandinitpckbuckettable(numofchars,maxdepth,false);
  pckbt->mapptr = mapptr;
  pckbt->mbtab[0] = (Mbtab *) (((Seqpos *) mapptr) + 1);
  setbcktaboffsets(pckbt);
  gt_assert(numofbytes ==
            sizeof (Seqpos) + sizeof (Mbtab) * pckbt->maxnumofvalues);
  return pckbt;
}