Merge "core: Disable astobj2 locking for some common objects."

This commit is contained in:
George Joseph
2018-10-03 10:16:20 -05:00
committed by Gerrit Code Review
5 changed files with 17 additions and 7 deletions

View File

@@ -222,7 +222,8 @@ int aco_option_register_deprecated(struct aco_info *info, const char *name, stru
return -1;
}
if (!(opt = ao2_alloc(sizeof(*opt), config_option_destroy))) {
opt = ao2_alloc_options(sizeof(*opt), config_option_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!opt) {
return -1;
}
@@ -313,7 +314,9 @@ int __aco_option_register(struct aco_info *info, const char *name, enum aco_matc
return -1;
}
if (!(opt = ao2_alloc(sizeof(*opt) + argc * sizeof(opt->args[0]), config_option_destroy))) {
opt = ao2_alloc_options(sizeof(*opt) + argc * sizeof(opt->args[0]),
config_option_destroy, AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!opt) {
return -1;
}

View File

@@ -588,7 +588,9 @@ static int ast_register_indication(struct ast_tone_zone *zone, const char *indic
}
AST_LIST_TRAVERSE_SAFE_END;
if (!(ts = ao2_alloc(sizeof(*ts), ast_tone_zone_sound_destructor))) {
ts = ao2_alloc_options(sizeof(*ts), ast_tone_zone_sound_destructor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!ts) {
return -1;
}

View File

@@ -584,7 +584,7 @@ void ast_module_register(const struct ast_module_info *info)
mod->info = info;
if (ast_opt_ref_debug) {
mod->ref_debug = ao2_t_alloc(0, NULL, info->name);
mod->ref_debug = ao2_t_alloc_options(0, NULL, AO2_ALLOC_OPT_LOCK_NOLOCK, info->name);
}
AST_LIST_HEAD_INIT(&mod->users);
AST_VECTOR_INIT(&mod->requires, 0);

View File

@@ -64,7 +64,8 @@ static struct media_variant *media_variant_alloc(const char *variant_str)
size_t str_sz = strlen(variant_str) + 1;
struct media_variant *variant;
variant = ao2_alloc(sizeof(*variant) + str_sz, media_variant_destroy);
variant = ao2_alloc_options(sizeof(*variant) + str_sz, media_variant_destroy,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!variant) {
return NULL;
}
@@ -110,8 +111,10 @@ static void media_info_destroy(void *obj)
static struct media_info *media_info_alloc(const char *name)
{
size_t name_sz = strlen(name) + 1;
struct media_info *info = ao2_alloc(sizeof(*info) + name_sz, media_info_destroy);
struct media_info *info;
info = ao2_alloc_options(sizeof(*info) + name_sz, media_info_destroy,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!info) {
return NULL;
}

View File

@@ -2290,7 +2290,9 @@ static struct ast_xml_doc_item *ast_xml_doc_item_alloc(const char *name, const c
{
struct ast_xml_doc_item *item;
if (!(item = ao2_alloc(sizeof(*item), ast_xml_doc_item_destructor))) {
item = ao2_alloc_options(sizeof(*item), ast_xml_doc_item_destructor,
AO2_ALLOC_OPT_LOCK_NOLOCK);
if (!item) {
ast_log(AST_LOG_ERROR, "Failed to allocate memory for ast_xml_doc_item instance\n");
return NULL;
}