[Asterisk-code-review] sorcery.c: Tweak some container declaration formatting. (asterisk[13])
Anonymous Coward
asteriskteam at digium.com
Tue Aug 16 09:06:52 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: sorcery.c: Tweak some container declaration formatting.
......................................................................
sorcery.c: Tweak some container declaration formatting.
* Tweak sorcery_object_type_alloc() formatting.
* Tweak ast_sorcery_init() formatting.
Change-Id: Ib02430023f15268cd7a2ea53f2c331213e4d3944
---
M main/sorcery.c
1 file changed, 20 insertions(+), 11 deletions(-)
Approvals:
Mark Michelson: Looks good to me, but someone else must approve
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, approved
diff --git a/main/sorcery.c b/main/sorcery.c
index bfc7688..737474e 100644
--- a/main/sorcery.c
+++ b/main/sorcery.c
@@ -505,13 +505,15 @@
};
ast_assert(wizards == NULL);
- if (!(threadpool = ast_threadpool_create("Sorcery", NULL, &options))) {
- threadpool = NULL;
+ threadpool = ast_threadpool_create("Sorcery", NULL, &options);
+ if (!threadpool) {
return -1;
}
- if (!(wizards = ao2_container_alloc(WIZARD_BUCKETS, sorcery_wizard_hash, sorcery_wizard_cmp))) {
- ast_threadpool_shutdown(threadpool);
+ wizards = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, WIZARD_BUCKETS,
+ sorcery_wizard_hash, NULL, sorcery_wizard_cmp);
+ if (!wizards) {
+ sorcery_cleanup();
return -1;
}
@@ -521,8 +523,8 @@
return -1;
}
- instances = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_RWLOCK, INSTANCE_BUCKETS,
- sorcery_instance_hash, sorcery_instance_cmp);
+ instances = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, INSTANCE_BUCKETS,
+ sorcery_instance_hash, NULL, sorcery_instance_cmp);
if (!instances) {
sorcery_cleanup();
return -1;
@@ -839,23 +841,30 @@
return NULL;
}
- if (!(object_type->fields = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, OBJECT_FIELD_BUCKETS,
- object_type_field_hash, object_type_field_cmp))) {
+ object_type->fields = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_NOLOCK, 0,
+ OBJECT_FIELD_BUCKETS, object_type_field_hash, NULL, object_type_field_cmp);
+ if (!object_type->fields) {
ao2_ref(object_type, -1);
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);
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);
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);
return NULL;
}
--
To view, visit https://gerrit.asterisk.org/3492
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib02430023f15268cd7a2ea53f2c331213e4d3944
Gerrit-PatchSet: 2
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-code-review
mailing list