Example #1
0
void
mowgli_allocation_policy_bootstrap(void)
{
	mowgli_allocation_policy_dict = mowgli_patricia_create(_allocation_policy_key_canon);

	mowgli_object_class_init(&klass, "mowgli.allocation_policy", NULL, FALSE);
}
Example #2
0
/*
 * mowgli_object_init
 *
 * Populates the object manager part of an object.
 *
 * Inputs:
 *      - pointer to object manager area
 *      - (optional) name of object
 *      - (optional) class of object
 *      - (optional) custom destructor
 *
 * Outputs:
 *      - none
 *
 * Side Effects:
 *      - none
 */
void
mowgli_object_init(mowgli_object_t *obj, const char *name, mowgli_object_class_t *klass, mowgli_destructor_t des)
{
	return_if_fail(obj != NULL);

	if (name != NULL)
		obj->name = mowgli_strdup(name);

	if (klass != NULL)
	{
		obj->klass = klass;
	}
	else
	{
		mowgli_object_class_t *tmp = mowgli_alloc(sizeof *tmp);
		mowgli_object_class_init(tmp, name, des, TRUE);
		obj->klass = tmp;
	}

	obj->refcount = 1;

	obj->message_handlers.head = NULL;
	obj->message_handlers.tail = NULL;
	obj->message_handlers.count = 0;

	obj->metadata.head = NULL;
	obj->metadata.tail = NULL;
	obj->metadata.count = 0;

	mowgli_object_message_broadcast(obj, "create");
}