mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-14 13:58:38 +00:00
astobj2: Eliminate usage of legacy container allocation macros.
These macros have been documented as legacy for a long time but are still used in new code because they exist. Remove all references to: * ao2_container_alloc_options * ao2_t_container_alloc_options * ao2_t_container_alloc These macro's are still available for use but only in modules. Only ao2_container_alloc remains due to it's use in over 100 places. Change-Id: I1a26258b5bf3deb081aaeed11a0baa175c933c7a
This commit is contained in:
@@ -611,8 +611,8 @@ struct ast_sorcery *__ast_sorcery_open(const char *module_name)
|
||||
goto done;
|
||||
}
|
||||
|
||||
sorcery->types = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_RWLOCK, TYPE_BUCKETS,
|
||||
ast_sorcery_object_type_hash_fn, ast_sorcery_object_type_cmp_fn);
|
||||
sorcery->types = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_RWLOCK, 0, TYPE_BUCKETS,
|
||||
ast_sorcery_object_type_hash_fn, NULL, ast_sorcery_object_type_cmp_fn);
|
||||
if (!sorcery->types) {
|
||||
ao2_ref(sorcery, -1);
|
||||
sorcery = NULL;
|
||||
@@ -1761,7 +1761,8 @@ void *ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const ch
|
||||
|
||||
/* If returning multiple objects create a container to store them in */
|
||||
if ((flags & AST_RETRIEVE_FLAG_MULTIPLE)) {
|
||||
if (!(object = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) {
|
||||
object = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL);
|
||||
if (!object) {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
@@ -1805,7 +1806,12 @@ struct ao2_container *ast_sorcery_retrieve_by_regex(const struct ast_sorcery *so
|
||||
struct ao2_container *objects;
|
||||
int i;
|
||||
|
||||
if (!object_type || !(objects = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) {
|
||||
if (!object_type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
objects = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL);
|
||||
if (!objects) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1835,7 +1841,12 @@ struct ao2_container *ast_sorcery_retrieve_by_prefix(const struct ast_sorcery *s
|
||||
struct ao2_container *objects;
|
||||
int i;
|
||||
|
||||
if (!object_type || !(objects = ao2_container_alloc_options(AO2_ALLOC_OPT_LOCK_NOLOCK, 1, NULL, NULL))) {
|
||||
if (!object_type) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
objects = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_NOLOCK, 0, NULL, NULL);
|
||||
if (!objects) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user