示例#1
0
IdentityData_t *id_create (Identity_t id, DDS_ReturnCode_t *ret)
{
	IdentityData_t	*p;
	unsigned	h;

	p = id_lookup (id, &h);
	if (p) {
		*ret = DDS_RETCODE_OK;
		return (p);
	}
	p = id_new (id);
	if (!p) {
		*ret = DDS_RETCODE_OUT_OF_RESOURCES;
		return (NULL);
	}
	id_add (p, h);
	return (p);
}
示例#2
0
void id_random_between(chordID *a, chordID *b, chordID *res)
{
	id_subtract(b, a, res);
	chordID r = random_from(res);
	id_add(a, &r, res);
}