Exemple #1
0
void inserthash(Hash *hash, Avl *data) {
	unsigned long cur = hashf(data, hash->order);
	Avl *oldp;
	if (hash->map[cur] == NULL)
		hash->map[cur] = mkavltree(&avlcmp);
	insertavl(hash->map[cur], data, &oldp);
}
Exemple #2
0
static void
_insertdb(Db *db, Entry *e)
{
	Entry *o, *ne;

	ne = allocentry();
	*ne = *e;
	o = nil;
	insertavl(db->avl, (Avl*)ne, (Avl**)&o);
	if(o)
		freeentry(o);
}
Exemple #3
0
static void
markvisited(uint8_t score[VtScoreSize], int type)
{
	ScoreTree *a;
	Avl *old;

	if(scoretree == nil)
		return;
	a = binalloc(&scorebin, sizeof *a, 1);
	memmove(a->score, score, VtScoreSize);
	a->type = type;
	insertavl(scoretree, &a->avl, &old);
}