Commit b875e802 authored by Philipp Schafft's avatar Philipp Schafft

Update: Replaced module_container_new()

parent bdbe3379
......@@ -38,7 +38,7 @@ void global_initialize(void)
global.clients = 0;
global.sources = 0;
global.source_tree = avl_tree_new(source_compare_sources, NULL);
global.modulecontainer = module_container_new();
global.modulecontainer = refobject_new(module_container_t);
thread_mutex_create(&_global_mutex);
}
......
......@@ -50,24 +50,22 @@ static void __module_container_free(refobject_t self, void **userdata)
avl_tree_free(cont->module, (avl_free_key_fun_type)refobject_unref);
}
REFOBJECT_DEFINE_TYPE(module_container_t,
REFOBJECT_DEFINE_TYPE_FREE(__module_container_free)
);
module_container_t * module_container_new(void)
int __module_container_new(refobject_t self, const refobject_type_t *type, va_list ap)
{
module_container_t *ret = refobject_new__new(module_container_t, NULL, NULL, NULL);
if (!ret)
return NULL;
module_container_t *ret = REFOBJECT_TO_TYPE(self, module_container_t*);
thread_mutex_create(&(ret->lock));
ret->module = avl_tree_new(compare_refobject_t_name, NULL);
return ret;
return 0;
}
REFOBJECT_DEFINE_TYPE(module_container_t,
REFOBJECT_DEFINE_TYPE_FREE(__module_container_free),
REFOBJECT_DEFINE_TYPE_NEW(__module_container_new)
);
int module_container_add_module(module_container_t *self, module_t *module)
{
if (!self)
......
......@@ -25,7 +25,6 @@ typedef struct {
REFOBJECT_FORWARD_TYPE(module_container_t);
REFOBJECT_FORWARD_TYPE(module_t);
module_container_t * module_container_new(void);
int module_container_add_module(module_container_t *self, module_t *module);
int module_container_delete_module(module_container_t *self, const char *name);
module_t * module_container_get_module(module_container_t *self, const char *name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment