mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-05 12:16:00 +00:00
sorcery.c: Tweak some container declaration formatting.
* Tweak sorcery_object_type_alloc() formatting. * Tweak ast_sorcery_init() formatting. Change-Id: Ib02430023f15268cd7a2ea53f2c331213e4d3944
This commit is contained in:
@@ -508,13 +508,15 @@ int ast_sorcery_init(void)
|
|||||||
};
|
};
|
||||||
ast_assert(wizards == NULL);
|
ast_assert(wizards == NULL);
|
||||||
|
|
||||||
if (!(threadpool = ast_threadpool_create("Sorcery", NULL, &options))) {
|
threadpool = ast_threadpool_create("Sorcery", NULL, &options);
|
||||||
threadpool = NULL;
|
if (!threadpool) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(wizards = ao2_container_alloc(WIZARD_BUCKETS, sorcery_wizard_hash, sorcery_wizard_cmp))) {
|
wizards = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, WIZARD_BUCKETS,
|
||||||
ast_threadpool_shutdown(threadpool);
|
sorcery_wizard_hash, NULL, sorcery_wizard_cmp);
|
||||||
|
if (!wizards) {
|
||||||
|
sorcery_cleanup();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -524,8 +526,8 @@ int ast_sorcery_init(void)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
instances = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_RWLOCK, INSTANCE_BUCKETS,
|
instances = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, INSTANCE_BUCKETS,
|
||||||
sorcery_instance_hash, sorcery_instance_cmp);
|
sorcery_instance_hash, NULL, sorcery_instance_cmp);
|
||||||
if (!instances) {
|
if (!instances) {
|
||||||
sorcery_cleanup();
|
sorcery_cleanup();
|
||||||
return -1;
|
return -1;
|
||||||
@@ -842,23 +844,30 @@ static struct ast_sorcery_object_type *sorcery_object_type_alloc(const char *typ
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(object_type->fields = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, OBJECT_FIELD_BUCKETS,
|
object_type->fields = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_NOLOCK, 0,
|
||||||
object_type_field_hash, object_type_field_cmp))) {
|
OBJECT_FIELD_BUCKETS, object_type_field_hash, NULL, object_type_field_cmp);
|
||||||
|
if (!object_type->fields) {
|
||||||
ao2_ref(object_type, -1);
|
ao2_ref(object_type, -1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(object_type->observers = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_RWLOCK, 1, NULL, NULL))) {
|
object_type->observers = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_RWLOCK, 0,
|
||||||
|
NULL, NULL);
|
||||||
|
if (!object_type->observers) {
|
||||||
ao2_ref(object_type, -1);
|
ao2_ref(object_type, -1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(object_type->info = ast_calloc(1, sizeof(*object_type->info) + 2 * sizeof(object_type->info->files[0])))) {
|
object_type->info = ast_calloc(1,
|
||||||
|
sizeof(*object_type->info) + 2 * sizeof(object_type->info->files[0]));
|
||||||
|
if (!object_type->info) {
|
||||||
ao2_ref(object_type, -1);
|
ao2_ref(object_type, -1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(object_type->file = ast_calloc(1, sizeof(*object_type->file) + 2 * sizeof(object_type->file->types[0])))) {
|
object_type->file = ast_calloc(1,
|
||||||
|
sizeof(*object_type->file) + 2 * sizeof(object_type->file->types[0]));
|
||||||
|
if (!object_type->file) {
|
||||||
ao2_ref(object_type, -1);
|
ao2_ref(object_type, -1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user