<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10698">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">astobj2: Eliminate usage of legacy ao2_container_alloc routine.<br><br>Replace usage of ao2_container_alloc with ao2_container_alloc_hash or<br>ao2_container_alloc_list.<br><br>ao2_container_alloc is now restricted to modules only and is being<br>removed from Asterisk 17.<br><br>Change-Id: I0907d78bc66efc775672df37c8faad00f2f6c088<br>---<br>M apps/app_confbridge.c<br>M apps/app_meetme.c<br>M apps/app_queue.c<br>M apps/app_skel.c<br>M apps/app_voicemail.c<br>M apps/confbridge/conf_config_parser.c<br>M channels/chan_console.c<br>M channels/chan_iax2.c<br>M channels/chan_motif.c<br>M channels/chan_sip.c<br>M channels/chan_unistim.c<br>M channels/sig_pri.c<br>M funcs/func_dialgroup.c<br>M funcs/func_lock.c<br>M funcs/func_odbc.c<br>M include/asterisk/astobj2.h<br>M main/cel.c<br>M main/channel.c<br>M main/channel_internal_api.c<br>M main/config.c<br>M main/config_options.c<br>M main/data.c<br>M main/endpoints.c<br>M main/indications.c<br>M main/manager.c<br>M main/media_index.c<br>M main/message.c<br>M main/named_acl.c<br>M main/pbx.c<br>M main/stasis.c<br>M main/stasis_channels.c<br>M main/taskprocessor.c<br>M main/threadpool.c<br>M main/xmldoc.c<br>M pbx/pbx_realtime.c<br>M res/res_calendar.c<br>M res/res_clialiases.c<br>M res/res_config_sqlite3.c<br>M res/res_corosync.c<br>M res/res_fax.c<br>M res/res_http_websocket.c<br>M res/res_odbc.c<br>M res/res_parking.c<br>M res/res_phoneprov.c<br>M res/res_pjsip/config_transport.c<br>M res/res_pjsip/pjsip_transport_management.c<br>M res/res_pjsip_mwi.c<br>M res/res_pjsip_outbound_publish.c<br>M res/res_pjsip_outbound_registration.c<br>M res/res_pjsip_pubsub.c<br>M res/res_pjsip_session.c<br>M res/res_rtp_asterisk.c<br>M res/res_sorcery_memory.c<br>M res/res_sorcery_memory_cache.c<br>M res/res_stasis.c<br>M res/res_stasis_device_state.c<br>M res/res_stasis_playback.c<br>M res/res_stasis_recording.c<br>M res/res_timing_pthread.c<br>M res/res_xmpp.c<br>M tests/test_astobj2.c<br>M tests/test_astobj2_thrash.c<br>M tests/test_cel.c<br>M tests/test_config.c<br>M tests/test_scoped_lock.c<br>65 files changed, 330 insertions(+), 224 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/98/10698/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c</span><br><span>index 9c6b690..d07c156 100644</span><br><span>--- a/apps/app_confbridge.c</span><br><span>+++ b/apps/app_confbridge.c</span><br><span>@@ -4093,8 +4093,9 @@</span><br><span> }</span><br><span> </span><br><span> /* Create a container to hold the conference bridges */</span><br><span style="color: hsl(0, 100%, 40%);">- conference_bridges = ao2_container_alloc(CONFERENCE_BRIDGE_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- conference_bridge_hash_cb, conference_bridge_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ conference_bridges = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ CONFERENCE_BRIDGE_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ conference_bridge_hash_cb, NULL, conference_bridge_cmp_cb);</span><br><span> if (!conference_bridges) {</span><br><span> unload_module();</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span>diff --git a/apps/app_meetme.c b/apps/app_meetme.c</span><br><span>index 9ef4621..d8493d0 100644</span><br><span>--- a/apps/app_meetme.c</span><br><span>+++ b/apps/app_meetme.c</span><br><span>@@ -1627,8 +1627,14 @@</span><br><span> </span><br><span> ast_format_cap_append(cap_slin, ast_format_slin, 0);</span><br><span> /* Make a new one */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cnf = ast_calloc(1, sizeof(*cnf))) ||</span><br><span style="color: hsl(0, 100%, 40%);">- !(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cnf = ast_calloc(1, sizeof(*cnf));</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cnf) {</span><br><span style="color: hsl(120, 100%, 40%);">+ goto cnfout;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ cnf->usercontainer = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, user_no_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cnf->usercontainer) {</span><br><span> goto cnfout;</span><br><span> }</span><br><span> </span><br><span>@@ -7398,13 +7404,6 @@</span><br><span> ast_string_field_free_memory(station);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int sla_trunk_hash(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- const struct sla_trunk *trunk = obj;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_str_case_hash(trunk->name);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static int sla_trunk_cmp(void *obj, void *arg, int flags)</span><br><span> {</span><br><span> struct sla_trunk *trunk = obj, *trunk2 = arg;</span><br><span>@@ -7412,13 +7411,6 @@</span><br><span> return !strcasecmp(trunk->name, trunk2->name) ? CMP_MATCH | CMP_STOP : 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int sla_station_hash(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- const struct sla_station *station = obj;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_str_case_hash(station->name);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static int sla_station_cmp(void *obj, void *arg, int flags)</span><br><span> {</span><br><span> struct sla_station *station = obj, *station2 = arg;</span><br><span>@@ -7872,8 +7864,10 @@</span><br><span> if (!reload) {</span><br><span> ast_mutex_init(&sla.lock);</span><br><span> ast_cond_init(&sla.cond, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- sla_trunks = ao2_container_alloc(1, sla_trunk_hash, sla_trunk_cmp);</span><br><span style="color: hsl(0, 100%, 40%);">- sla_stations = ao2_container_alloc(1, sla_station_hash, sla_station_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ sla_trunks = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, sla_trunk_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ sla_stations = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, sla_station_cmp);</span><br><span> }</span><br><span> </span><br><span> if (!(cfg = ast_config_load(SLA_CONFIG_FILE, config_flags))) {</span><br><span>diff --git a/apps/app_queue.c b/apps/app_queue.c</span><br><span>index ce00b5e..b6b9255 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -2700,9 +2700,10 @@</span><br><span> if (!q->members) {</span><br><span> if (q->strategy == QUEUE_STRATEGY_LINEAR || q->strategy == QUEUE_STRATEGY_RRORDERED) {</span><br><span> /* linear strategy depends on order, so we have to place all members in a single bucket */</span><br><span style="color: hsl(0, 100%, 40%);">- q->members = ao2_container_alloc(1, member_hash_fn, member_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ q->members = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, member_cmp_fn);</span><br><span> } else {</span><br><span style="color: hsl(0, 100%, 40%);">- q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ q->members = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ member_hash_fn, NULL, member_cmp_fn);</span><br><span> }</span><br><span> }</span><br><span> q->found = 1;</span><br><span>@@ -10925,13 +10926,14 @@</span><br><span> struct stasis_topic *queue_topic;</span><br><span> struct stasis_topic *manager_topic;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- queues = ao2_container_alloc(MAX_QUEUE_BUCKETS, queue_hash_cb, queue_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ queues = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_QUEUE_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ queue_hash_cb, NULL, queue_cmp_cb);</span><br><span> if (!queues) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- pending_members = ao2_container_alloc(</span><br><span style="color: hsl(0, 100%, 40%);">- MAX_CALL_ATTEMPT_BUCKETS, pending_members_hash, pending_members_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ pending_members = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ MAX_CALL_ATTEMPT_BUCKETS, pending_members_hash, NULL, pending_members_cmp);</span><br><span> if (!pending_members) {</span><br><span> unload_module();</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span>diff --git a/apps/app_skel.c b/apps/app_skel.c</span><br><span>index ae50bb5..f15c344 100644</span><br><span>--- a/apps/app_skel.c</span><br><span>+++ b/apps/app_skel.c</span><br><span>@@ -582,7 +582,9 @@</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->levels = ao2_container_alloc(LEVEL_BUCKETS, skel_level_hash, skel_level_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->levels = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, LEVEL_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ skel_level_hash, NULL, skel_level_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->levels) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span>@@ -727,7 +729,9 @@</span><br><span> if (aco_info_init(&cfg_info)) {</span><br><span> goto error;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(games = ao2_container_alloc(1, NULL, NULL))) {</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ games = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!games) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span>diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c</span><br><span>index aa114a8..f45c596 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -15018,11 +15018,14 @@</span><br><span> my_umask = umask(0);</span><br><span> umask(my_umask);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(inprocess_container = ao2_container_alloc(573, inprocess_hash_fn, inprocess_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ inprocess_container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 573,</span><br><span style="color: hsl(120, 100%, 40%);">+ inprocess_hash_fn, NULL, inprocess_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!inprocess_container) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- poll_list = ao2_container_alloc(POLL_LIST_BUCKETS, poll_state_hash_fn, poll_state_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ poll_list = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, POLL_LIST_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ poll_state_hash_fn, NULL, poll_state_cmp_fn);</span><br><span> if (!poll_list) {</span><br><span> ast_log(LOG_ERROR, "Unable to create poll_list container\n");</span><br><span> ao2_cleanup(inprocess_container);</span><br><span>diff --git a/apps/confbridge/conf_config_parser.c b/apps/confbridge/conf_config_parser.c</span><br><span>index d1406c1..9486260 100644</span><br><span>--- a/apps/confbridge/conf_config_parser.c</span><br><span>+++ b/apps/confbridge/conf_config_parser.c</span><br><span>@@ -1822,15 +1822,21 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->user_profiles = ao2_container_alloc(283, user_hash_cb, user_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->user_profiles = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 283,</span><br><span style="color: hsl(120, 100%, 40%);">+ user_hash_cb, NULL, user_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->user_profiles) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->bridge_profiles = ao2_container_alloc(283, bridge_hash_cb, bridge_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->bridge_profiles = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 283,</span><br><span style="color: hsl(120, 100%, 40%);">+ bridge_hash_cb, NULL, bridge_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->bridge_profiles) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->menus = ao2_container_alloc(283, menu_hash_cb, menu_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->menus = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 283,</span><br><span style="color: hsl(120, 100%, 40%);">+ menu_hash_cb, NULL, menu_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->menus) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span>diff --git a/channels/chan_console.c b/channels/chan_console.c</span><br><span>index f09694b..cdd7a25 100644</span><br><span>--- a/channels/chan_console.c</span><br><span>+++ b/channels/chan_console.c</span><br><span>@@ -1536,7 +1536,9 @@</span><br><span> </span><br><span> init_pvt(&globals, NULL);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(pvts = ao2_container_alloc(NUM_PVT_BUCKETS, pvt_hash_cb, pvt_cmp_cb)))</span><br><span style="color: hsl(120, 100%, 40%);">+ pvts = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NUM_PVT_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ pvt_hash_cb, NULL, pvt_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!pvts)</span><br><span> goto return_error;</span><br><span> </span><br><span> if (load_config(0))</span><br><span>diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c</span><br><span>index d534c00..b485fd1 100644</span><br><span>--- a/channels/chan_iax2.c</span><br><span>+++ b/channels/chan_iax2.c</span><br><span>@@ -14858,23 +14858,54 @@</span><br><span> peers = users = iax_peercallno_pvts = iax_transfercallno_pvts = NULL;</span><br><span> peercnts = callno_limits = calltoken_ignores = NULL;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(peers = ao2_container_alloc(MAX_PEER_BUCKETS, peer_hash_cb, peer_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ peers = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_PEER_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ peer_hash_cb, NULL, peer_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!peers) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(users = ao2_container_alloc(MAX_USER_BUCKETS, user_hash_cb, user_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ users = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_USER_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ user_hash_cb, NULL, user_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!users) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(iax_peercallno_pvts = ao2_container_alloc(IAX_MAX_CALLS, pvt_hash_cb, pvt_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ iax_peercallno_pvts = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ IAX_MAX_CALLS, pvt_hash_cb, NULL, pvt_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!iax_peercallno_pvts) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(iax_transfercallno_pvts = ao2_container_alloc(IAX_MAX_CALLS, transfercallno_pvt_hash_cb, transfercallno_pvt_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ iax_transfercallno_pvts = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ IAX_MAX_CALLS, transfercallno_pvt_hash_cb, NULL, transfercallno_pvt_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!iax_transfercallno_pvts) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(peercnts = ao2_container_alloc(MAX_PEER_BUCKETS, peercnt_hash_cb, peercnt_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ peercnts = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_PEER_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ peercnt_hash_cb, NULL, peercnt_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!peercnts) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(callno_limits = ao2_container_alloc(MAX_PEER_BUCKETS, addr_range_hash_cb, addr_range_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ callno_limits = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ MAX_PEER_BUCKETS, addr_range_hash_cb, NULL, addr_range_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!callno_limits) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(calltoken_ignores = ao2_container_alloc(MAX_PEER_BUCKETS, addr_range_hash_cb, addr_range_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ calltoken_ignores = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ MAX_PEER_BUCKETS, addr_range_hash_cb, NULL, addr_range_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!calltoken_ignores) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (create_callno_pools()) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (create_callno_pools()) {</span><br><span> goto container_fail;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!(transmit_processor = ast_taskprocessor_get("iax2_transmit", TPS_REF_DEFAULT))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ transmit_processor = ast_taskprocessor_get("iax2_transmit", TPS_REF_DEFAULT);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!transmit_processor) {</span><br><span> goto container_fail;</span><br><span> }</span><br><span> </span><br><span>diff --git a/channels/chan_motif.c b/channels/chan_motif.c</span><br><span>index a80f8be..97a56d5 100644</span><br><span>--- a/channels/chan_motif.c</span><br><span>+++ b/channels/chan_motif.c</span><br><span>@@ -473,7 +473,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(state->sessions = ao2_container_alloc(SESSION_BUCKETS, jingle_session_hash, jingle_session_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ state->sessions = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ SESSION_BUCKETS, jingle_session_hash, NULL, jingle_session_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!state->sessions) {</span><br><span> ao2_ref(state, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>@@ -607,7 +609,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->endpoints = ao2_container_alloc(ENDPOINT_BUCKETS, jingle_endpoint_hash, jingle_endpoint_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->endpoints = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ ENDPOINT_BUCKETS, jingle_endpoint_hash, NULL, jingle_endpoint_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->endpoints) {</span><br><span> ao2_ref(cfg, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/channels/chan_sip.c b/channels/chan_sip.c</span><br><span>index 49d5f64..d90c1c7 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -1768,8 +1768,9 @@</span><br><span> {</span><br><span> int i, res = 0;</span><br><span> for (i = 0; i < ARRAY_LEN(event_state_compositors); i++) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!((event_state_compositors[i].compositor) =</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_container_alloc(ESC_MAX_BUCKETS, esc_hash_fn, esc_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ event_state_compositors[i].compositor = ao2_container_alloc_hash(</span><br><span style="color: hsl(120, 100%, 40%);">+ AO2_ALLOC_OPT_LOCK_MUTEX, 0, ESC_MAX_BUCKETS, esc_hash_fn, NULL, esc_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!event_state_compositors[i].compositor) {</span><br><span> res = -1;</span><br><span> }</span><br><span> }</span><br><span>@@ -35507,7 +35508,9 @@</span><br><span> unload_module();</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(sip_monitor_instances = ao2_container_alloc(37, sip_monitor_instance_hash_fn, sip_monitor_instance_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ sip_monitor_instances = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ sip_monitor_instance_hash_fn, NULL, sip_monitor_instance_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!sip_monitor_instances) {</span><br><span> unload_module();</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span>diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c</span><br><span>index 5d8e47c..1809c8a 100644</span><br><span>--- a/channels/chan_unistim.c</span><br><span>+++ b/channels/chan_unistim.c</span><br><span>@@ -815,7 +815,9 @@</span><br><span> char tmp[1024], *p, *p_orig = NULL, *p_trans = NULL;</span><br><span> FILE *f;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(lang->trans = ao2_container_alloc(8, lang_hash_fn, lang_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ lang->trans = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 8,</span><br><span style="color: hsl(120, 100%, 40%);">+ lang_hash_fn, NULL, lang_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!lang->trans) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate container for translation!\n");</span><br><span> return str;</span><br><span> }</span><br><span>diff --git a/channels/sig_pri.c b/channels/sig_pri.c</span><br><span>index 682abf3..69fe346 100644</span><br><span>--- a/channels/sig_pri.c</span><br><span>+++ b/channels/sig_pri.c</span><br><span>@@ -10146,8 +10146,8 @@</span><br><span> </span><br><span> #if defined(HAVE_PRI_CCSS)</span><br><span> sig_pri_cc_type_name = cc_type_name;</span><br><span style="color: hsl(0, 100%, 40%);">- sig_pri_cc_monitors = ao2_container_alloc(37, sig_pri_cc_monitor_instance_hash_fn,</span><br><span style="color: hsl(0, 100%, 40%);">- sig_pri_cc_monitor_instance_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ sig_pri_cc_monitors = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ sig_pri_cc_monitor_instance_hash_fn, NULL, sig_pri_cc_monitor_instance_cmp_fn);</span><br><span> if (!sig_pri_cc_monitors) {</span><br><span> return -1;</span><br><span> }</span><br><span>diff --git a/funcs/func_dialgroup.c b/funcs/func_dialgroup.c</span><br><span>index 37aba6a..01348b0 100644</span><br><span>--- a/funcs/func_dialgroup.c</span><br><span>+++ b/funcs/func_dialgroup.c</span><br><span>@@ -223,7 +223,8 @@</span><br><span> grhead = ao2_alloc(sizeof(*grhead), group_destroy);</span><br><span> if (!grhead)</span><br><span> return -1;</span><br><span style="color: hsl(0, 100%, 40%);">- grhead->entries = ao2_container_alloc(37, entry_hash_fn, entry_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ grhead->entries = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ entry_hash_fn, NULL, entry_cmp_fn);</span><br><span> if (!grhead->entries) {</span><br><span> ao2_ref(grhead, -1);</span><br><span> return -1;</span><br><span>@@ -238,7 +239,9 @@</span><br><span> </span><br><span> /* Remove all existing */</span><br><span> ao2_ref(grhead->entries, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(grhead->entries = ao2_container_alloc(37, entry_hash_fn, entry_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ grhead->entries = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ entry_hash_fn, NULL, entry_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!grhead->entries) {</span><br><span> ao2_unlink(group_container, grhead);</span><br><span> ao2_ref(grhead, -1);</span><br><span> return -1;</span><br><span>@@ -299,7 +302,9 @@</span><br><span> struct ast_db_entry *dbtree, *tmp;</span><br><span> char groupname[AST_MAX_EXTENSION], *ptr;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if ((group_container = ao2_container_alloc(37, group_hash_fn, group_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ group_container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ group_hash_fn, NULL, group_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (group_container) {</span><br><span> /* Refresh groups from astdb */</span><br><span> if ((dbtree = ast_db_gettree("dialgroup", NULL))) {</span><br><span> for (tmp = dbtree; tmp; tmp = tmp->next) {</span><br><span>diff --git a/funcs/func_lock.c b/funcs/func_lock.c</span><br><span>index e56d56d..a006a57 100644</span><br><span>--- a/funcs/func_lock.c</span><br><span>+++ b/funcs/func_lock.c</span><br><span>@@ -217,12 +217,6 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int ast_channel_hash_cb(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- const struct ast_channel *chan = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_str_case_hash(ast_channel_name(chan));</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static int ast_channel_cmp_cb(void *obj, void *arg, int flags)</span><br><span> {</span><br><span> struct ast_channel *chan = obj, *cmp_args = arg;</span><br><span>@@ -298,7 +292,9 @@</span><br><span> AST_LIST_UNLOCK(&locklist);</span><br><span> return -1;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(current->requesters = ao2_container_alloc(1, ast_channel_hash_cb, ast_channel_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ current->requesters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, ast_channel_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!current->requesters) {</span><br><span> ast_mutex_destroy(¤t->mutex);</span><br><span> ast_cond_destroy(¤t->cond);</span><br><span> ast_free(current);</span><br><span>diff --git a/funcs/func_odbc.c b/funcs/func_odbc.c</span><br><span>index f4821c0..70f02b8 100644</span><br><span>--- a/funcs/func_odbc.c</span><br><span>+++ b/funcs/func_odbc.c</span><br><span>@@ -1795,7 +1795,8 @@</span><br><span> dsns = NULL;</span><br><span> </span><br><span> if (single_db_connection) {</span><br><span style="color: hsl(0, 100%, 40%);">- dsns = ao2_container_alloc(DSN_BUCKETS, dsn_hash, dsn_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ dsns = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, DSN_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ dsn_hash, NULL, dsn_cmp);</span><br><span> if (!dsns) {</span><br><span> ast_log(LOG_ERROR, "Could not initialize DSN container\n");</span><br><span> ast_rwlock_unlock(&single_db_connection_lock);</span><br><span>@@ -1893,7 +1894,8 @@</span><br><span> }</span><br><span> </span><br><span> if (single_db_connection) {</span><br><span style="color: hsl(0, 100%, 40%);">- dsns = ao2_container_alloc(DSN_BUCKETS, dsn_hash, dsn_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ dsns = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, DSN_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ dsn_hash, NULL, dsn_cmp);</span><br><span> if (!dsns) {</span><br><span> ast_log(LOG_ERROR, "Could not initialize DSN container\n");</span><br><span> ast_rwlock_unlock(&single_db_connection_lock);</span><br><span>diff --git a/include/asterisk/astobj2.h b/include/asterisk/astobj2.h</span><br><span>index 0e32e89..4765fdc 100644</span><br><span>--- a/include/asterisk/astobj2.h</span><br><span>+++ b/include/asterisk/astobj2.h</span><br><span>@@ -92,7 +92,8 @@</span><br><span> </span><br><span> struct ao2_container *c;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- c = ao2_container_alloc(MAX_BUCKETS, my_hash_fn, my_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ c = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ my_hash_fn, NULL, my_cmp_fn);</span><br><span> \endcode</span><br><span> </span><br><span> where</span><br><span>@@ -108,7 +109,7 @@</span><br><span> other than the fact that they have been created by ao2_alloc().</span><br><span> All knowledge of the (user-defined) internals of the objects</span><br><span> is left to the (user-supplied) functions passed as arguments</span><br><span style="color: hsl(0, 100%, 40%);">-to ao2_container_alloc().</span><br><span style="color: hsl(120, 100%, 40%);">+to ao2_container_alloc_hash().</span><br><span> </span><br><span> If we want to insert an object in a container, we should</span><br><span> initialize its fields -- especially, those used by my_hash_fn() --</span><br><span>@@ -856,20 +857,8 @@</span><br><span> Internally, objects are stored in lists, hash tables or other</span><br><span> data structures depending on the needs.</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-\note NOTA BENE: at the moment the only container we support is the</span><br><span style="color: hsl(0, 100%, 40%);">- hash table and its degenerate form, the list.</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> Operations on container include:</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- - c = \b ao2_container_alloc(size, hash_fn, cmp_fn)</span><br><span style="color: hsl(0, 100%, 40%);">- allocate a container with desired size and default compare</span><br><span style="color: hsl(0, 100%, 40%);">- and hash function</span><br><span style="color: hsl(0, 100%, 40%);">- -The compare function returns an int, which</span><br><span style="color: hsl(0, 100%, 40%);">- can be 0 for not found, CMP_STOP to stop end a traversal,</span><br><span style="color: hsl(0, 100%, 40%);">- or CMP_MATCH if they are equal</span><br><span style="color: hsl(0, 100%, 40%);">- -The hash function returns an int. The hash function</span><br><span style="color: hsl(0, 100%, 40%);">- takes two argument, the object pointer and a flags field,</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> - \b ao2_find(c, arg, flags)</span><br><span> returns zero or more elements matching a given criteria</span><br><span> (specified as arg). 'c' is the container pointer. Flags</span><br><span>@@ -1217,6 +1206,10 @@</span><br><span> /*@{ */</span><br><span> struct ao2_container;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#ifndef AST_IN_CORE</span><br><span style="color: hsl(120, 100%, 40%);">+/* These macros are removed from Asterisk 17. They are still available to modules</span><br><span style="color: hsl(120, 100%, 40%);">+ * but should only be used by third party modules that have not been updated. */</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*!</span><br><span> * \deprecated</span><br><span> * \brief Allocate and initialize a hash container with the desired number of buckets.</span><br><span>@@ -1236,17 +1229,13 @@</span><br><span> * \note Destructor is set implicitly.</span><br><span> * \note This is legacy container creation that is mapped to the new method.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">-#define ao2_container_alloc(n_buckets, hash_fn, cmp_fn) \</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, (n_buckets), (hash_fn), NULL, (cmp_fn))</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-#ifndef AST_IN_CORE</span><br><span style="color: hsl(0, 100%, 40%);">-/* These macros are removed from Asterisk 17. They are still available to modules</span><br><span style="color: hsl(0, 100%, 40%);">- * but should only be used by third party modules that have not been updated. */</span><br><span> #define ao2_t_container_alloc_options(options, n_buckets, hash_fn, cmp_fn, tag) \</span><br><span> ao2_t_container_alloc_hash((options), 0, (n_buckets), (hash_fn), NULL, (cmp_fn), (tag))</span><br><span> #define ao2_container_alloc_options(options, n_buckets, hash_fn, cmp_fn) \</span><br><span> ao2_container_alloc_hash((options), 0, (n_buckets), (hash_fn), NULL, (cmp_fn))</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#define ao2_container_alloc(n_buckets, hash_fn, cmp_fn) \</span><br><span style="color: hsl(120, 100%, 40%);">+ ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, (n_buckets), (hash_fn), NULL, (cmp_fn))</span><br><span> #define ao2_t_container_alloc(n_buckets, hash_fn, cmp_fn, tag) \</span><br><span> ao2_t_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, (n_buckets), (hash_fn), NULL, (cmp_fn), (tag))</span><br><span> #endif</span><br><span>diff --git a/main/cel.c b/main/cel.c</span><br><span>index 45726e0..4e67581 100644</span><br><span>--- a/main/cel.c</span><br><span>+++ b/main/cel.c</span><br><span>@@ -1561,15 +1561,16 @@</span><br><span> {</span><br><span> struct ao2_container *container;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- container = ao2_container_alloc(NUM_APP_BUCKETS, cel_linkedid_hash_fn, cel_linkedid_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NUM_APP_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ cel_linkedid_hash_fn, NULL, cel_linkedid_cmp_fn);</span><br><span> ao2_global_obj_replace_unref(cel_linkedids, container);</span><br><span> ao2_cleanup(container);</span><br><span> if (!container) {</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- container = ao2_container_alloc(NUM_DIALSTATUS_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- cel_dialstatus_hash_fn, cel_dialstatus_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_DIALSTATUS_BUCKETS, cel_dialstatus_hash_fn, NULL, cel_dialstatus_cmp_fn);</span><br><span> ao2_global_obj_replace_unref(cel_dialstatus_store, container);</span><br><span> ao2_cleanup(container);</span><br><span> if (!container) {</span><br><span>@@ -1584,7 +1585,8 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- container = ao2_container_alloc(BACKEND_BUCKETS, cel_backend_hash_fn, cel_backend_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, BACKEND_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ cel_backend_hash_fn, NULL, cel_backend_cmp_fn);</span><br><span> ao2_global_obj_replace_unref(cel_backends, container);</span><br><span> ao2_cleanup(container);</span><br><span> if (!container) {</span><br><span>diff --git a/main/channel.c b/main/channel.c</span><br><span>index e5bd879..c1eecdb 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -8056,8 +8056,8 @@</span><br><span> </span><br><span> int ast_channels_init(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- channels = ao2_container_alloc(NUM_CHANNEL_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_channel_hash_cb, ast_channel_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ channels = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NUM_CHANNEL_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_hash_cb, NULL, ast_channel_cmp_cb);</span><br><span> if (!channels) {</span><br><span> return -1;</span><br><span> }</span><br><span>diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c</span><br><span>index 6e429b3..72ca1a9 100644</span><br><span>--- a/main/channel_internal_api.c</span><br><span>+++ b/main/channel_internal_api.c</span><br><span>@@ -1462,7 +1462,9 @@</span><br><span> return ast_channel_unref(tmp);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(tmp->dialed_causes = ao2_container_alloc(DIALED_CAUSES_BUCKETS, pvt_cause_hash_fn, pvt_cause_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ tmp->dialed_causes = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DIALED_CAUSES_BUCKETS, pvt_cause_hash_fn, NULL, pvt_cause_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!tmp->dialed_causes) {</span><br><span> return ast_channel_unref(tmp);</span><br><span> }</span><br><span> </span><br><span>diff --git a/main/config.c b/main/config.c</span><br><span>index a8fae05..d864af2 100644</span><br><span>--- a/main/config.c</span><br><span>+++ b/main/config.c</span><br><span>@@ -2545,7 +2545,8 @@</span><br><span> struct ao2_container *fileset;</span><br><span> struct inclfile *fi;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- fileset = ao2_container_alloc(1023, hash_string, hashtab_compare_strings);</span><br><span style="color: hsl(120, 100%, 40%);">+ fileset = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 1023,</span><br><span style="color: hsl(120, 100%, 40%);">+ hash_string, NULL, hashtab_compare_strings);</span><br><span> if (!fileset) {</span><br><span> /* Container creation failed. */</span><br><span> return -1;</span><br><span>@@ -4112,8 +4113,12 @@</span><br><span> config_hook_cb hook_cb)</span><br><span> {</span><br><span> struct cfg_hook *hook;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!cfg_hooks && !(cfg_hooks = ao2_container_alloc(17, hook_hash, hook_cmp))) {</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg_hooks) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg_hooks = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 17,</span><br><span style="color: hsl(120, 100%, 40%);">+ hook_hash, NULL, hook_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg_hooks) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> if (!(hook = ao2_alloc(sizeof(*hook), hook_destroy))) {</span><br><span>diff --git a/main/config_options.c b/main/config_options.c</span><br><span>index f8b2be8..75d5ad1 100644</span><br><span>--- a/main/config_options.c</span><br><span>+++ b/main/config_options.c</span><br><span>@@ -407,7 +407,8 @@</span><br><span> </span><br><span> struct ao2_container *aco_option_container_alloc(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- return ao2_container_alloc(CONFIG_OPT_BUCKETS, config_opt_hash, config_opt_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ return ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, CONFIG_OPT_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ config_opt_hash, NULL, config_opt_cmp);</span><br><span> }</span><br><span> </span><br><span> static int internal_aco_type_category_check(struct aco_type *match, const char *category)</span><br><span>diff --git a/main/data.c b/main/data.c</span><br><span>index 5972949..b703b56 100644</span><br><span>--- a/main/data.c</span><br><span>+++ b/main/data.c</span><br><span>@@ -323,8 +323,9 @@</span><br><span> strcpy(node->name, name);</span><br><span> </span><br><span> /* initialize the childrens container. */</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(node->children = ao2_container_alloc(NUM_DATA_NODE_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- data_provider_hash, data_provider_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ node->children = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_DATA_NODE_BUCKETS, data_provider_hash, NULL, data_provider_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!node->children) {</span><br><span> ao2_ref(node, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>@@ -698,8 +699,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- res->children = ao2_container_alloc(NUM_DATA_SEARCH_BUCKETS, data_search_hash,</span><br><span style="color: hsl(0, 100%, 40%);">- data_search_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ res->children = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_DATA_SEARCH_BUCKETS, data_search_hash, NULL, data_search_cmp);</span><br><span> </span><br><span> if (!res->children) {</span><br><span> ao2_ref(res, -1);</span><br><span>@@ -1418,8 +1419,8 @@</span><br><span> strcpy(res->name, namelen ? name : "");</span><br><span> </span><br><span> /* initialize the children container */</span><br><span style="color: hsl(0, 100%, 40%);">- res->children = ao2_container_alloc(NUM_DATA_RESULT_BUCKETS, data_result_hash,</span><br><span style="color: hsl(0, 100%, 40%);">- data_result_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ res->children = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_DATA_RESULT_BUCKETS, data_result_hash, NULL, data_result_cmp);</span><br><span> if (!res->children) {</span><br><span> ao2_ref(res, -1);</span><br><span> return NULL;</span><br><span>@@ -1656,8 +1657,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- res->children = ao2_container_alloc(NUM_DATA_FILTER_BUCKETS, data_filter_hash,</span><br><span style="color: hsl(0, 100%, 40%);">- data_filter_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ res->children = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_DATA_FILTER_BUCKETS, data_filter_hash, NULL, data_filter_cmp);</span><br><span> </span><br><span> if (!res->children) {</span><br><span> ao2_ref(res, -1);</span><br><span>@@ -3335,8 +3336,9 @@</span><br><span> </span><br><span> ast_rwlock_init(&root_data.lock);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(root_data.container = ao2_container_alloc(NUM_DATA_NODE_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- data_provider_hash, data_provider_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ root_data.container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_DATA_NODE_BUCKETS, data_provider_hash, NULL, data_provider_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!root_data.container) {</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span>diff --git a/main/endpoints.c b/main/endpoints.c</span><br><span>index 69d022f..b68f207 100644</span><br><span>--- a/main/endpoints.c</span><br><span>+++ b/main/endpoints.c</span><br><span>@@ -484,14 +484,14 @@</span><br><span> {</span><br><span> ast_register_cleanup(endpoint_cleanup);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- endpoints = ao2_container_alloc(ENDPOINT_BUCKETS, ast_endpoint_hash_fn,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_endpoint_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ endpoints = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, ENDPOINT_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_endpoint_hash_fn, NULL, ast_endpoint_cmp_fn);</span><br><span> if (!endpoints) {</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- tech_endpoints = ao2_container_alloc(TECH_ENDPOINT_BUCKETS, ast_endpoint_hash_fn,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_endpoint_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ tech_endpoints = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ TECH_ENDPOINT_BUCKETS, ast_endpoint_hash_fn, NULL, ast_endpoint_cmp_fn);</span><br><span> if (!tech_endpoints) {</span><br><span> return -1;</span><br><span> }</span><br><span>diff --git a/main/indications.c b/main/indications.c</span><br><span>index e0ba59b..f193792 100644</span><br><span>--- a/main/indications.c</span><br><span>+++ b/main/indications.c</span><br><span>@@ -1174,8 +1174,8 @@</span><br><span> /*! \brief Load indications module */</span><br><span> int ast_indications_init(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_tone_zones = ao2_container_alloc(NUM_TONE_ZONE_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- ast_tone_zone_hash, ast_tone_zone_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_tone_zones = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_TONE_ZONE_BUCKETS, ast_tone_zone_hash, NULL, ast_tone_zone_cmp);</span><br><span> if (!ast_tone_zones) {</span><br><span> return -1;</span><br><span> }</span><br><span>diff --git a/main/manager.c b/main/manager.c</span><br><span>index 5b4cc3a..47b31bb 100644</span><br><span>--- a/main/manager.c</span><br><span>+++ b/main/manager.c</span><br><span>@@ -2224,8 +2224,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- newsession->whitefilters = ao2_container_alloc(1, NULL, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- newsession->blackfilters = ao2_container_alloc(1, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ newsession->whitefilters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ newsession->blackfilters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span> if (!newsession->whitefilters || !newsession->blackfilters) {</span><br><span> ao2_ref(newsession, -1);</span><br><span> return NULL;</span><br><span>@@ -7612,7 +7612,8 @@</span><br><span> if (xml) {</span><br><span> ast_str_append(out, 0, "<response type='object' id='%s'><%s", dest, objtype);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- vco = ao2_container_alloc(37, variable_count_hash_fn, variable_count_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ vco = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ variable_count_hash_fn, NULL, variable_count_cmp_fn);</span><br><span> inobj = 1;</span><br><span> }</span><br><span> </span><br><span>@@ -9052,7 +9053,7 @@</span><br><span> #endif</span><br><span> </span><br><span> /* If you have a NULL hash fn, you only need a single bucket */</span><br><span style="color: hsl(0, 100%, 40%);">- sessions = ao2_container_alloc(1, NULL, mansession_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ sessions = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, mansession_cmp_fn);</span><br><span> if (!sessions) {</span><br><span> return -1;</span><br><span> }</span><br><span>@@ -9308,8 +9309,8 @@</span><br><span> /* Default allowmultiplelogin from [general] */</span><br><span> user->allowmultiplelogin = allowmultiplelogin;</span><br><span> user->writetimeout = 100;</span><br><span style="color: hsl(0, 100%, 40%);">- user->whitefilters = ao2_container_alloc(1, NULL, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- user->blackfilters = ao2_container_alloc(1, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ user->whitefilters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ user->blackfilters = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span> if (!user->whitefilters || !user->blackfilters) {</span><br><span> manager_free_user(user);</span><br><span> break;</span><br><span>diff --git a/main/media_index.c b/main/media_index.c</span><br><span>index bfaa580..2d1bc6b 100644</span><br><span>--- a/main/media_index.c</span><br><span>+++ b/main/media_index.c</span><br><span>@@ -121,7 +121,8 @@</span><br><span> </span><br><span> memcpy(info->name, name, name_sz);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- info->variants = ao2_container_alloc(VARIANT_BUCKETS, media_variant_hash, media_variant_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ info->variants = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ VARIANT_BUCKETS, media_variant_hash, NULL, media_variant_cmp);</span><br><span> if (!info->variants) {</span><br><span> ao2_ref(info, -1);</span><br><span> </span><br><span>@@ -169,7 +170,8 @@</span><br><span> </span><br><span> memcpy(index->base_dir, base_dir, base_dir_sz);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- index->index = ao2_container_alloc(INDEX_BUCKETS, media_info_hash, media_info_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ index->index = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, INDEX_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ media_info_hash, NULL, media_info_cmp);</span><br><span> if (!index->index) {</span><br><span> ao2_ref(index, -1);</span><br><span> </span><br><span>diff --git a/main/message.c b/main/message.c</span><br><span>index 7ba2e26..0543bf4 100644</span><br><span>--- a/main/message.c</span><br><span>+++ b/main/message.c</span><br><span>@@ -369,12 +369,6 @@</span><br><span> ao2_ref(msg, -1);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int msg_data_hash_fn(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- const struct msg_data *data = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_str_case_hash(data->name);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static int msg_data_cmp_fn(void *obj, void *arg, int flags)</span><br><span> {</span><br><span> const struct msg_data *one = obj, *two = arg;</span><br><span>@@ -408,7 +402,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(msg->vars = ao2_container_alloc(1, msg_data_hash_fn, msg_data_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ msg->vars = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, msg_data_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!msg->vars) {</span><br><span> ao2_ref(msg, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/main/named_acl.c b/main/named_acl.c</span><br><span>index 826313d..e61bcba 100644</span><br><span>--- a/main/named_acl.c</span><br><span>+++ b/main/named_acl.c</span><br><span>@@ -128,7 +128,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->named_acl_list = ao2_container_alloc(37, named_acl_hash_fn, named_acl_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->named_acl_list = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ named_acl_hash_fn, NULL, named_acl_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->named_acl_list) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span>diff --git a/main/pbx.c b/main/pbx.c</span><br><span>index 434173d..93bd9e6 100644</span><br><span>--- a/main/pbx.c</span><br><span>+++ b/main/pbx.c</span><br><span>@@ -3907,7 +3907,7 @@</span><br><span> AST_VECTOR_INIT(&hint_new->devices, 8);</span><br><span> </span><br><span> /* Initialize new hint. */</span><br><span style="color: hsl(0, 100%, 40%);">- hint_new->callbacks = ao2_container_alloc(1, NULL, hint_id_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ hint_new->callbacks = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, hint_id_cmp);</span><br><span> if (!hint_new->callbacks) {</span><br><span> ao2_ref(hint_new, -1);</span><br><span> return -1;</span><br><span>@@ -8753,15 +8753,17 @@</span><br><span> </span><br><span> int ast_pbx_init(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- hints = ao2_container_alloc(HASH_EXTENHINT_SIZE, hint_hash, hint_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ hints = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ HASH_EXTENHINT_SIZE, hint_hash, NULL, hint_cmp);</span><br><span> if (hints) {</span><br><span> ao2_container_register("hints", hints, print_hints_key);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- hintdevices = ao2_container_alloc(HASH_EXTENHINT_SIZE, hintdevice_hash_cb, hintdevice_cmp_multiple);</span><br><span style="color: hsl(120, 100%, 40%);">+ hintdevices = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ HASH_EXTENHINT_SIZE, hintdevice_hash_cb, NULL, hintdevice_cmp_multiple);</span><br><span> if (hintdevices) {</span><br><span> ao2_container_register("hintdevices", hintdevices, print_hintdevices_key);</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- statecbs = ao2_container_alloc(1, NULL, statecbs_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ statecbs = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, statecbs_cmp);</span><br><span> if (statecbs) {</span><br><span> ao2_container_register("statecbs", statecbs, print_statecbs_key);</span><br><span> }</span><br><span>diff --git a/main/stasis.c b/main/stasis.c</span><br><span>index d054897..b30bee0 100644</span><br><span>--- a/main/stasis.c</span><br><span>+++ b/main/stasis.c</span><br><span>@@ -1285,8 +1285,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- pool->pool_container = ao2_container_alloc(TOPIC_POOL_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- topic_pool_entry_hash, topic_pool_entry_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ pool->pool_container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ TOPIC_POOL_BUCKETS, topic_pool_entry_hash, NULL, topic_pool_entry_cmp);</span><br><span> if (!pool->pool_container) {</span><br><span> ao2_cleanup(pool);</span><br><span> return NULL;</span><br><span>diff --git a/main/stasis_channels.c b/main/stasis_channels.c</span><br><span>index ed460cc..8c7a85f 100644</span><br><span>--- a/main/stasis_channels.c</span><br><span>+++ b/main/stasis_channels.c</span><br><span>@@ -613,8 +613,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- obj->channel_snapshots = ao2_container_alloc(NUM_MULTI_CHANNEL_BLOB_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- channel_role_hash_cb, channel_role_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ obj->channel_snapshots = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_MULTI_CHANNEL_BLOB_BUCKETS, channel_role_hash_cb, NULL, channel_role_cmp_cb);</span><br><span> if (!obj->channel_snapshots) {</span><br><span> ao2_ref(obj, -1);</span><br><span> return NULL;</span><br><span>@@ -717,8 +717,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ret_container = ao2_container_alloc(NUM_MULTI_CHANNEL_BLOB_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- channel_snapshot_hash_cb, channel_snapshot_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ ret_container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NUM_MULTI_CHANNEL_BLOB_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ channel_snapshot_hash_cb, NULL, channel_snapshot_cmp_cb);</span><br><span> if (!ret_container) {</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/main/taskprocessor.c b/main/taskprocessor.c</span><br><span>index d475650..84c4d2b 100644</span><br><span>--- a/main/taskprocessor.c</span><br><span>+++ b/main/taskprocessor.c</span><br><span>@@ -280,7 +280,9 @@</span><br><span> /* initialize the taskprocessor container and register CLI operations */</span><br><span> int ast_tps_init(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(tps_singletons = ao2_container_alloc(TPS_MAX_BUCKETS, tps_hash_cb, tps_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ tps_singletons = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ TPS_MAX_BUCKETS, tps_hash_cb, NULL, tps_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!tps_singletons) {</span><br><span> ast_log(LOG_ERROR, "taskprocessor container failed to initialize!\n");</span><br><span> return -1;</span><br><span> }</span><br><span>diff --git a/main/threadpool.c b/main/threadpool.c</span><br><span>index 7729930..2ab0936 100644</span><br><span>--- a/main/threadpool.c</span><br><span>+++ b/main/threadpool.c</span><br><span>@@ -420,15 +420,18 @@</span><br><span> if (!pool->control_tps) {</span><br><span> return NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- pool->active_threads = ao2_container_alloc(THREAD_BUCKETS, worker_thread_hash, worker_thread_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ pool->active_threads = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ THREAD_BUCKETS, worker_thread_hash, NULL, worker_thread_cmp);</span><br><span> if (!pool->active_threads) {</span><br><span> return NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- pool->idle_threads = ao2_container_alloc(THREAD_BUCKETS, worker_thread_hash, worker_thread_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ pool->idle_threads = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ THREAD_BUCKETS, worker_thread_hash, NULL, worker_thread_cmp);</span><br><span> if (!pool->idle_threads) {</span><br><span> return NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- pool->zombie_threads = ao2_container_alloc(THREAD_BUCKETS, worker_thread_hash, worker_thread_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ pool->zombie_threads = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ THREAD_BUCKETS, worker_thread_hash, NULL, worker_thread_cmp);</span><br><span> if (!pool->zombie_threads) {</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/main/xmldoc.c b/main/xmldoc.c</span><br><span>index 37b2861..27bf76b 100644</span><br><span>--- a/main/xmldoc.c</span><br><span>+++ b/main/xmldoc.c</span><br><span>@@ -2659,7 +2659,9 @@</span><br><span> struct documentation_tree *doctree;</span><br><span> const char *name;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(docs = ao2_container_alloc(127, ast_xml_doc_item_hash, ast_xml_doc_item_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ docs = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 127,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_xml_doc_item_hash, NULL, ast_xml_doc_item_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!docs) {</span><br><span> ast_log(AST_LOG_ERROR, "Failed to create container for xml document item instances\n");</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/pbx/pbx_realtime.c b/pbx/pbx_realtime.c</span><br><span>index 9778984..e331781 100644</span><br><span>--- a/pbx/pbx_realtime.c</span><br><span>+++ b/pbx/pbx_realtime.c</span><br><span>@@ -403,7 +403,9 @@</span><br><span> </span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cache = ao2_container_alloc(573, cache_hash, cache_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cache = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 573,</span><br><span style="color: hsl(120, 100%, 40%);">+ cache_hash, NULL, cache_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cache) {</span><br><span> return AST_MODULE_LOAD_FAILURE;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_calendar.c b/res/res_calendar.c</span><br><span>index e8ad499..8962f47 100644</span><br><span>--- a/res/res_calendar.c</span><br><span>+++ b/res/res_calendar.c</span><br><span>@@ -409,7 +409,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cal->events = ao2_container_alloc(CALENDAR_BUCKETS, event_hash_fn, event_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cal->events = ast_calendar_event_container_alloc();</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cal->events) {</span><br><span> ast_log(LOG_ERROR, "Could not allocate events container for %s\n", cat);</span><br><span> cal = unref_calendar(cal);</span><br><span> return NULL;</span><br><span>@@ -672,7 +673,8 @@</span><br><span> </span><br><span> struct ao2_container *ast_calendar_event_container_alloc(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- return ao2_container_alloc(CALENDAR_BUCKETS, event_hash_fn, event_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ return ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, CALENDAR_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ event_hash_fn, NULL, event_cmp_fn);</span><br><span> }</span><br><span> </span><br><span> static void event_notification_destroy(void *data)</span><br><span>@@ -1865,7 +1867,9 @@</span><br><span> */</span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(calendars = ao2_container_alloc(CALENDAR_BUCKETS, calendar_hash_fn, calendar_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ calendars = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, CALENDAR_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ calendar_hash_fn, NULL, calendar_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!calendars) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate calendars container!\n");</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span>diff --git a/res/res_clialiases.c b/res/res_clialiases.c</span><br><span>index 355d437..7032214 100644</span><br><span>--- a/res/res_clialiases.c</span><br><span>+++ b/res/res_clialiases.c</span><br><span>@@ -284,7 +284,9 @@</span><br><span> */</span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cli_aliases = ao2_container_alloc(MAX_ALIAS_BUCKETS, alias_hash_cb, alias_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cli_aliases = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ MAX_ALIAS_BUCKETS, alias_hash_cb, NULL, alias_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cli_aliases) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_config_sqlite3.c b/res/res_config_sqlite3.c</span><br><span>index a033970..6148d5d 100644</span><br><span>--- a/res/res_config_sqlite3.c</span><br><span>+++ b/res/res_config_sqlite3.c</span><br><span>@@ -1185,7 +1185,9 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(columns = ao2_container_alloc(31, str_hash_fn, str_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ columns = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 31,</span><br><span style="color: hsl(120, 100%, 40%);">+ str_hash_fn, NULL, str_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!columns) {</span><br><span> unref_db(&db);</span><br><span> return -1;</span><br><span> }</span><br><span>@@ -1360,7 +1362,9 @@</span><br><span> {</span><br><span> discover_sqlite3_caps();</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!((databases = ao2_container_alloc(DB_BUCKETS, db_hash_fn, db_cmp_fn)))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ databases = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, DB_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ db_hash_fn, NULL, db_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!databases) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_corosync.c b/res/res_corosync.c</span><br><span>index af8afdb..b1518c5 100644</span><br><span>--- a/res/res_corosync.c</span><br><span>+++ b/res/res_corosync.c</span><br><span>@@ -1127,7 +1127,8 @@</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- nodes = ao2_container_alloc(23, corosync_node_hash_fn, corosync_node_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ nodes = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 23,</span><br><span style="color: hsl(120, 100%, 40%);">+ corosync_node_hash_fn, NULL, corosync_node_cmp_fn);</span><br><span> if (!nodes) {</span><br><span> goto failed;</span><br><span> }</span><br><span>diff --git a/res/res_fax.c b/res/res_fax.c</span><br><span>index ce5687d..b7aadc1 100644</span><br><span>--- a/res/res_fax.c</span><br><span>+++ b/res/res_fax.c</span><br><span>@@ -4724,7 +4724,9 @@</span><br><span> /* initialize the registry */</span><br><span> faxregistry.active_sessions = 0;</span><br><span> faxregistry.reserved_sessions = 0;</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(faxregistry.container = ao2_container_alloc(FAX_MAXBUCKETS, session_hash_cb, session_cmp_cb))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ faxregistry.container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ FAX_MAXBUCKETS, session_hash_cb, NULL, session_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!faxregistry.container) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_http_websocket.c b/res/res_http_websocket.c</span><br><span>index 0ff876b..d52e6b3 100644</span><br><span>--- a/res/res_http_websocket.c</span><br><span>+++ b/res/res_http_websocket.c</span><br><span>@@ -154,7 +154,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- server->protocols = ao2_container_alloc(MAX_PROTOCOL_BUCKETS, protocol_hash_fn, protocol_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ server->protocols = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ MAX_PROTOCOL_BUCKETS, protocol_hash_fn, NULL, protocol_cmp_fn);</span><br><span> if (!server->protocols) {</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/res/res_odbc.c b/res/res_odbc.c</span><br><span>index 9622beb..cd588ee 100644</span><br><span>--- a/res/res_odbc.c</span><br><span>+++ b/res/res_odbc.c</span><br><span>@@ -190,11 +190,6 @@</span><br><span> ast_cond_destroy(&class->cond);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int null_hash_fn(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> static void odbc_obj_destructor(void *data)</span><br><span> {</span><br><span> struct odbc_obj *obj = data;</span><br><span>@@ -1066,7 +1061,8 @@</span><br><span> </span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(class_container = ao2_container_alloc(1, null_hash_fn, ao2_match_by_addr)))</span><br><span style="color: hsl(120, 100%, 40%);">+ class_container = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, ao2_match_by_addr);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!class_container)</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> if (load_odbc_config() == -1)</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span>diff --git a/res/res_parking.c b/res/res_parking.c</span><br><span>index ddf8012..f5279a8 100644</span><br><span>--- a/res/res_parking.c</span><br><span>+++ b/res/res_parking.c</span><br><span>@@ -387,7 +387,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->parking_lots = ao2_container_alloc(37, parking_lot_cfg_hash_fn, parking_lot_cfg_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->parking_lots = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 37,</span><br><span style="color: hsl(120, 100%, 40%);">+ parking_lot_cfg_hash_fn, NULL, parking_lot_cfg_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->parking_lots) {</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_phoneprov.c b/res/res_phoneprov.c</span><br><span>index 89fb29c..7091b9b 100644</span><br><span>--- a/res/res_phoneprov.c</span><br><span>+++ b/res/res_phoneprov.c</span><br><span>@@ -1414,13 +1414,15 @@</span><br><span> */</span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- profiles = ao2_container_alloc(MAX_PROFILE_BUCKETS, phone_profile_hash_fn, phone_profile_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ profiles = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_PROFILE_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ phone_profile_hash_fn, NULL, phone_profile_cmp_fn);</span><br><span> if (!profiles) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate profiles container.\n");</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- http_routes = ao2_container_alloc(MAX_ROUTE_BUCKETS, http_route_hash_fn, http_route_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ http_routes = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_ROUTE_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ http_route_hash_fn, NULL, http_route_cmp_fn);</span><br><span> if (!http_routes) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate routes container.\n");</span><br><span> goto error;</span><br><span>@@ -1431,13 +1433,15 @@</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- users = ao2_container_alloc(MAX_USER_BUCKETS, user_hash_fn, user_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ users = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MAX_USER_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ user_hash_fn, NULL, user_cmp_fn);</span><br><span> if (!users) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate users container.\n");</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- providers = ao2_container_alloc(MAX_PROVIDER_BUCKETS, phoneprov_provider_hash_fn, phoneprov_provider_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ providers = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ MAX_PROVIDER_BUCKETS, phoneprov_provider_hash_fn, NULL, phoneprov_provider_cmp_fn);</span><br><span> if (!providers) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate providers container.\n");</span><br><span> goto error;</span><br><span>diff --git a/res/res_pjsip/config_transport.c b/res/res_pjsip/config_transport.c</span><br><span>index 3ad4dcc..fed56f9 100644</span><br><span>--- a/res/res_pjsip/config_transport.c</span><br><span>+++ b/res/res_pjsip/config_transport.c</span><br><span>@@ -1376,7 +1376,8 @@</span><br><span> </span><br><span> struct ao2_container *ast_sip_get_transport_states(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ao2_container *states = ao2_container_alloc(DEFAULT_STATE_BUCKETS, transport_state_hash, transport_state_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ struct ao2_container *states = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DEFAULT_STATE_BUCKETS, transport_state_hash, NULL, transport_state_cmp);</span><br><span> </span><br><span> if (!states) {</span><br><span> return NULL;</span><br><span>@@ -1393,7 +1394,8 @@</span><br><span> struct ao2_container *transports = NULL;</span><br><span> </span><br><span> /* Create outbound registration states container. */</span><br><span style="color: hsl(0, 100%, 40%);">- transport_states = ao2_container_alloc(DEFAULT_STATE_BUCKETS, internal_state_hash, internal_state_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ transport_states = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DEFAULT_STATE_BUCKETS, internal_state_hash, NULL, internal_state_cmp);</span><br><span> if (!transport_states) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate transport states container\n");</span><br><span> return -1;</span><br><span>diff --git a/res/res_pjsip/pjsip_transport_management.c b/res/res_pjsip/pjsip_transport_management.c</span><br><span>index e7483e6..89ad1fc 100644</span><br><span>--- a/res/res_pjsip/pjsip_transport_management.c</span><br><span>+++ b/res/res_pjsip/pjsip_transport_management.c</span><br><span>@@ -354,8 +354,8 @@</span><br><span> {</span><br><span> struct ao2_container *transports;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- transports = ao2_container_alloc(TRANSPORTS_BUCKETS, monitored_transport_hash_fn,</span><br><span style="color: hsl(0, 100%, 40%);">- monitored_transport_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ transports = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, TRANSPORTS_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ monitored_transport_hash_fn, NULL, monitored_transport_cmp_fn);</span><br><span> if (!transports) {</span><br><span> ast_log(LOG_ERROR, "Could not create container for transports to perform keepalive on.\n");</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span>diff --git a/res/res_pjsip_mwi.c b/res/res_pjsip_mwi.c</span><br><span>index f8c2392..5622515 100644</span><br><span>--- a/res/res_pjsip_mwi.c</span><br><span>+++ b/res/res_pjsip_mwi.c</span><br><span>@@ -361,7 +361,8 @@</span><br><span> sub->sip_sub = sip_sub;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- sub->stasis_subs = ao2_container_alloc(STASIS_BUCKETS, stasis_sub_hash, stasis_sub_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ sub->stasis_subs = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ STASIS_BUCKETS, stasis_sub_hash, NULL, stasis_sub_cmp);</span><br><span> if (!sub->stasis_subs) {</span><br><span> ao2_cleanup(sub);</span><br><span> return NULL;</span><br><span>diff --git a/res/res_pjsip_outbound_publish.c b/res/res_pjsip_outbound_publish.c</span><br><span>index 2d49cd8..820be54 100644</span><br><span>--- a/res/res_pjsip_outbound_publish.c</span><br><span>+++ b/res/res_pjsip_outbound_publish.c</span><br><span>@@ -1074,7 +1074,8 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- state->client->datastores = ao2_container_alloc(DATASTORE_BUCKETS, datastore_hash, datastore_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ state->client->datastores = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DATASTORE_BUCKETS, datastore_hash, NULL, datastore_cmp);</span><br><span> if (!state->client->datastores) {</span><br><span> ao2_ref(state, -1);</span><br><span> return NULL;</span><br><span>diff --git a/res/res_pjsip_outbound_registration.c b/res/res_pjsip_outbound_registration.c</span><br><span>index c42f59e..b73b5a7 100644</span><br><span>--- a/res/res_pjsip_outbound_registration.c</span><br><span>+++ b/res/res_pjsip_outbound_registration.c</span><br><span>@@ -2197,8 +2197,8 @@</span><br><span> }</span><br><span> </span><br><span> /* Create outbound registration states container. */</span><br><span style="color: hsl(0, 100%, 40%);">- new_states = ao2_container_alloc(DEFAULT_STATE_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- registration_state_hash, registration_state_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ new_states = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DEFAULT_STATE_BUCKETS, registration_state_hash, NULL, registration_state_cmp);</span><br><span> if (!new_states) {</span><br><span> ast_log(LOG_ERROR, "Unable to allocate registration states container\n");</span><br><span> unload_module();</span><br><span>diff --git a/res/res_pjsip_pubsub.c b/res/res_pjsip_pubsub.c</span><br><span>index eb4545b..ab3e4b2 100644</span><br><span>--- a/res/res_pjsip_pubsub.c</span><br><span>+++ b/res/res_pjsip_pubsub.c</span><br><span>@@ -1251,7 +1251,8 @@</span><br><span> }</span><br><span> strcpy(sub->resource, resource); /* Safe */</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- sub->datastores = ao2_container_alloc(DATASTORE_BUCKETS, datastore_hash, datastore_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ sub->datastores = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DATASTORE_BUCKETS, datastore_hash, NULL, datastore_cmp);</span><br><span> if (!sub->datastores) {</span><br><span> destroy_subscription(sub);</span><br><span> return NULL;</span><br><span>@@ -2741,8 +2742,9 @@</span><br><span> return -1;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(handler->publications = ao2_container_alloc(PUBLICATIONS_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- publication_hash_fn, publication_cmp_fn))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ handler->publications = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ PUBLICATIONS_BUCKETS, publication_hash_fn, NULL, publication_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!handler->publications) {</span><br><span> ast_log(LOG_ERROR, "Could not allocate publications container for event '%s'\n",</span><br><span> handler->event_name);</span><br><span> return -1;</span><br><span>@@ -3181,7 +3183,9 @@</span><br><span> </span><br><span> ast_module_ref(ast_module_info->self);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(publication->datastores = ao2_container_alloc(DATASTORE_BUCKETS, datastore_hash, datastore_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ publication->datastores = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DATASTORE_BUCKETS, datastore_hash, NULL, datastore_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!publication->datastores) {</span><br><span> ao2_ref(publication, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index 669315f..ee12099 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -1412,7 +1412,8 @@</span><br><span> if (!session->req_caps) {</span><br><span> return NULL;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- session->datastores = ao2_container_alloc(DATASTORE_BUCKETS, datastore_hash, datastore_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ session->datastores = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DATASTORE_BUCKETS, datastore_hash, NULL, datastore_cmp);</span><br><span> if (!session->datastores) {</span><br><span> return NULL;</span><br><span> }</span><br><span>@@ -1434,7 +1435,8 @@</span><br><span> </span><br><span> session->endpoint = ao2_bump(endpoint);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- session->media = ao2_container_alloc(MEDIA_BUCKETS, session_media_hash, session_media_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ session->media = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, MEDIA_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ session_media_hash, NULL, session_media_cmp);</span><br><span> if (!session->media) {</span><br><span> return NULL;</span><br><span> }</span><br><span>@@ -3267,8 +3269,8 @@</span><br><span> }</span><br><span> nat_hook->outgoing_external_message = session_outgoing_nat_hook;</span><br><span> ast_sorcery_create(ast_sip_get_sorcery(), nat_hook);</span><br><span style="color: hsl(0, 100%, 40%);">- sdp_handlers = ao2_container_alloc(SDP_HANDLER_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- sdp_handler_list_hash, sdp_handler_list_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ sdp_handlers = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ SDP_HANDLER_BUCKETS, sdp_handler_list_hash, NULL, sdp_handler_list_cmp);</span><br><span> if (!sdp_handlers) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span>diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c</span><br><span>index 7b006ce..8841f6d 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -642,9 +642,12 @@</span><br><span> return;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!rtp->ice_proposed_remote_candidates &&</span><br><span style="color: hsl(0, 100%, 40%);">- !(rtp->ice_proposed_remote_candidates = ao2_container_alloc(1, NULL, ice_candidate_cmp))) {</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!rtp->ice_proposed_remote_candidates) {</span><br><span style="color: hsl(120, 100%, 40%);">+ rtp->ice_proposed_remote_candidates = ao2_container_alloc_list(</span><br><span style="color: hsl(120, 100%, 40%);">+ AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, ice_candidate_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!rtp->ice_proposed_remote_candidates) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> /* If this is going to exceed the maximum number of ICE candidates don't even add it */</span><br><span>@@ -1059,8 +1062,12 @@</span><br><span> </span><br><span> pj_ice_calc_foundation(rtp->ice->real_ice->pool, &foundation, type, addr);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!rtp->ice_local_candidates && !(rtp->ice_local_candidates = ao2_container_alloc(1, NULL, ice_candidate_cmp))) {</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!rtp->ice_local_candidates) {</span><br><span style="color: hsl(120, 100%, 40%);">+ rtp->ice_local_candidates = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, ice_candidate_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!rtp->ice_local_candidates) {</span><br><span style="color: hsl(120, 100%, 40%);">+ return;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> </span><br><span> if (!(candidate = ao2_alloc(sizeof(*candidate), ast_rtp_ice_candidate_destroy))) {</span><br><span>diff --git a/res/res_sorcery_memory.c b/res/res_sorcery_memory.c</span><br><span>index a05f05d..953bcb2 100644</span><br><span>--- a/res/res_sorcery_memory.c</span><br><span>+++ b/res/res_sorcery_memory.c</span><br><span>@@ -252,7 +252,8 @@</span><br><span> </span><br><span> static void *sorcery_memory_open(const char *data)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- return ao2_container_alloc(OBJECT_BUCKETS, sorcery_memory_hash, sorcery_memory_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ return ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, OBJECT_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ sorcery_memory_hash, NULL, sorcery_memory_cmp);</span><br><span> }</span><br><span> </span><br><span> static void sorcery_memory_close(void *data)</span><br><span>diff --git a/res/res_sorcery_memory_cache.c b/res/res_sorcery_memory_cache.c</span><br><span>index 9a1ade0..42da727 100644</span><br><span>--- a/res/res_sorcery_memory_cache.c</span><br><span>+++ b/res/res_sorcery_memory_cache.c</span><br><span>@@ -3528,7 +3528,8 @@</span><br><span> {</span><br><span> int res;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- caches = ao2_container_alloc(CACHES_CONTAINER_BUCKET_SIZE, sorcery_memory_cache_hash,</span><br><span style="color: hsl(120, 100%, 40%);">+ caches = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ CACHES_CONTAINER_BUCKET_SIZE, sorcery_memory_cache_hash, NULL,</span><br><span> sorcery_memory_cache_cmp);</span><br><span> if (!caches) {</span><br><span> ast_log(LOG_ERROR, "Failed to create container for configured caches\n");</span><br><span>diff --git a/res/res_stasis.c b/res/res_stasis.c</span><br><span>index 8362848..127d0e8 100644</span><br><span>--- a/res/res_stasis.c</span><br><span>+++ b/res/res_stasis.c</span><br><span>@@ -2155,9 +2155,12 @@</span><br><span> if (STASIS_MESSAGE_TYPE_INIT(end_message_type) != 0) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- apps_registry = ao2_container_alloc(APPS_NUM_BUCKETS, app_hash, app_compare);</span><br><span style="color: hsl(0, 100%, 40%);">- app_controls = ao2_container_alloc(CONTROLS_NUM_BUCKETS, control_hash, control_compare);</span><br><span style="color: hsl(0, 100%, 40%);">- app_bridges = ao2_container_alloc(BRIDGES_NUM_BUCKETS, bridges_hash, bridges_compare);</span><br><span style="color: hsl(120, 100%, 40%);">+ apps_registry = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ APPS_NUM_BUCKETS, app_hash, NULL, app_compare);</span><br><span style="color: hsl(120, 100%, 40%);">+ app_controls = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ CONTROLS_NUM_BUCKETS, control_hash, NULL, control_compare);</span><br><span style="color: hsl(120, 100%, 40%);">+ app_bridges = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ BRIDGES_NUM_BUCKETS, bridges_hash, NULL, bridges_compare);</span><br><span> app_bridges_moh = ao2_container_alloc_hash(</span><br><span> AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span> 37, bridges_channel_hash_fn, NULL, NULL);</span><br><span>diff --git a/res/res_stasis_device_state.c b/res/res_stasis_device_state.c</span><br><span>index fbdfb3d..d1a9bf7 100644</span><br><span>--- a/res/res_stasis_device_state.c</span><br><span>+++ b/res/res_stasis_device_state.c</span><br><span>@@ -463,9 +463,10 @@</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(device_state_subscriptions = ao2_container_alloc(</span><br><span style="color: hsl(0, 100%, 40%);">- DEVICE_STATE_BUCKETS, device_state_subscriptions_hash,</span><br><span style="color: hsl(0, 100%, 40%);">- device_state_subscriptions_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ device_state_subscriptions = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ DEVICE_STATE_BUCKETS, device_state_subscriptions_hash, NULL,</span><br><span style="color: hsl(120, 100%, 40%);">+ device_state_subscriptions_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!device_state_subscriptions) {</span><br><span> ast_devstate_prov_del(DEVICE_STATE_PROVIDER_STASIS);</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span>diff --git a/res/res_stasis_playback.c b/res/res_stasis_playback.c</span><br><span>index 6a0e6c3..999e6d0 100644</span><br><span>--- a/res/res_stasis_playback.c</span><br><span>+++ b/res/res_stasis_playback.c</span><br><span>@@ -667,8 +667,8 @@</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- playbacks = ao2_container_alloc(PLAYBACK_BUCKETS, playback_hash,</span><br><span style="color: hsl(0, 100%, 40%);">- playback_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ playbacks = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, PLAYBACK_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ playback_hash, NULL, playback_cmp);</span><br><span> if (!playbacks) {</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(stasis_app_playback_snapshot_type);</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span>diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c</span><br><span>index 93c32c9..66203df 100644</span><br><span>--- a/res/res_stasis_recording.c</span><br><span>+++ b/res/res_stasis_recording.c</span><br><span>@@ -636,8 +636,8 @@</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- recordings = ao2_container_alloc(RECORDING_BUCKETS, recording_hash,</span><br><span style="color: hsl(0, 100%, 40%);">- recording_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ recordings = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, RECORDING_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ recording_hash, NULL, recording_cmp);</span><br><span> if (!recordings) {</span><br><span> STASIS_MESSAGE_TYPE_CLEANUP(stasis_app_recording_snapshot_type);</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span>diff --git a/res/res_timing_pthread.c b/res/res_timing_pthread.c</span><br><span>index f57c737..eee0749 100644</span><br><span>--- a/res/res_timing_pthread.c</span><br><span>+++ b/res/res_timing_pthread.c</span><br><span>@@ -442,8 +442,9 @@</span><br><span> </span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(pthread_timers = ao2_container_alloc(PTHREAD_TIMER_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">- pthread_timer_hash, pthread_timer_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ pthread_timers = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ PTHREAD_TIMER_BUCKETS, pthread_timer_hash, NULL, pthread_timer_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!pthread_timers) {</span><br><span> return AST_MODULE_LOAD_DECLINE;</span><br><span> }</span><br><span> </span><br><span>diff --git a/res/res_xmpp.c b/res/res_xmpp.c</span><br><span>index a85892f..2c2a0a9 100644</span><br><span>--- a/res/res_xmpp.c</span><br><span>+++ b/res/res_xmpp.c</span><br><span>@@ -643,7 +643,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(client->buddies = ao2_container_alloc(BUDDY_BUCKETS, xmpp_buddy_hash, xmpp_buddy_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ client->buddies = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, BUDDY_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ xmpp_buddy_hash, NULL, xmpp_buddy_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!client->buddies) {</span><br><span> ast_log(LOG_ERROR, "Could not initialize buddy container for '%s'\n", name);</span><br><span> ao2_ref(client, -1);</span><br><span> return NULL;</span><br><span>@@ -709,7 +711,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->buddies = ao2_container_alloc(BUDDY_BUCKETS, xmpp_buddy_hash, xmpp_buddy_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->buddies = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, BUDDY_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+ xmpp_buddy_hash, NULL, xmpp_buddy_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->buddies) {</span><br><span> ao2_ref(cfg, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>@@ -727,14 +731,6 @@</span><br><span> ao2_cleanup(cfg->clients);</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/*! \brief Hashing function for configuration */</span><br><span style="color: hsl(0, 100%, 40%);">-static int xmpp_config_hash(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- const struct ast_xmpp_client_config *cfg = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *name = (flags & OBJ_KEY) ? obj : cfg->name;</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_str_case_hash(name);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> /*! \brief Comparator function for configuration */</span><br><span> static int xmpp_config_cmp(void *obj, void *arg, int flags)</span><br><span> {</span><br><span>@@ -756,7 +752,9 @@</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->clients = ao2_container_alloc(1, xmpp_config_hash, xmpp_config_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->clients = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ NULL, xmpp_config_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->clients) {</span><br><span> goto error;</span><br><span> }</span><br><span> </span><br><span>@@ -2256,7 +2254,9 @@</span><br><span> return NULL;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- if (!(buddy->resources = ao2_container_alloc(RESOURCE_BUCKETS, xmpp_resource_hash, xmpp_resource_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ buddy->resources = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ RESOURCE_BUCKETS, xmpp_resource_hash, NULL, xmpp_resource_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!buddy->resources) {</span><br><span> ao2_ref(buddy, -1);</span><br><span> return NULL;</span><br><span> }</span><br><span>diff --git a/tests/test_astobj2.c b/tests/test_astobj2.c</span><br><span>index 68f48ed..c0b9501 100644</span><br><span>--- a/tests/test_astobj2.c</span><br><span>+++ b/tests/test_astobj2.c</span><br><span>@@ -461,7 +461,7 @@</span><br><span> c2 = ao2_t_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL, "test");</span><br><span> </span><br><span> if (!c1 || !c2) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_test_status_update(test, "ao2_container_alloc failed.\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "ao2_container_alloc_list failed.\n");</span><br><span> res = AST_TEST_FAIL;</span><br><span> goto cleanup;</span><br><span> }</span><br><span>@@ -714,9 +714,9 @@</span><br><span> break;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- c = ao2_container_alloc(1, NULL, test_cmp_cb);</span><br><span style="color: hsl(120, 100%, 40%);">+ c = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, test_cmp_cb);</span><br><span> if (!c) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_test_status_update(test, "ao2_container_alloc failed.\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_test_status_update(test, "ao2_container_alloc_list failed.\n");</span><br><span> res = AST_TEST_FAIL;</span><br><span> goto cleanup;</span><br><span> }</span><br><span>diff --git a/tests/test_astobj2_thrash.c b/tests/test_astobj2_thrash.c</span><br><span>index 324c4f4..36e0ef7 100644</span><br><span>--- a/tests/test_astobj2_thrash.c</span><br><span>+++ b/tests/test_astobj2_thrash.c</span><br><span>@@ -268,8 +268,8 @@</span><br><span> data.preload = MAX_HASH_ENTRIES / 2;</span><br><span> data.max_grow = MAX_HASH_ENTRIES - data.preload;</span><br><span> data.deadline = ast_tvadd(ast_tvnow(), ast_tv(MAX_TEST_SECONDS, 0));</span><br><span style="color: hsl(0, 100%, 40%);">- data.to_be_thrashed = ao2_container_alloc(HASH_BUCKETS, hash_string,</span><br><span style="color: hsl(0, 100%, 40%);">- compare_strings);</span><br><span style="color: hsl(120, 100%, 40%);">+ data.to_be_thrashed = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+ HASH_BUCKETS, hash_string, NULL, compare_strings);</span><br><span> </span><br><span> if (data.to_be_thrashed == NULL) {</span><br><span> ast_test_status_update(test, "Allocation failed\n");</span><br><span>diff --git a/tests/test_cel.c b/tests/test_cel.c</span><br><span>index 9a3dc81..1461f76 100644</span><br><span>--- a/tests/test_cel.c</span><br><span>+++ b/tests/test_cel.c</span><br><span>@@ -1839,8 +1839,8 @@</span><br><span> ast_cel_set_config(cel_test_config);</span><br><span> </span><br><span> /* init CEL event storage (degenerate hash table becomes a linked list) */</span><br><span style="color: hsl(0, 100%, 40%);">- cel_received_events = ao2_container_alloc(1, NULL, NULL);</span><br><span style="color: hsl(0, 100%, 40%);">- cel_expected_events = ao2_container_alloc(1, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ cel_received_events = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ cel_expected_events = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, NULL);</span><br><span> </span><br><span> /* start the CEL event callback */</span><br><span> if (ast_cel_backend_register(TEST_BACKEND_NAME, test_sub)) {</span><br><span>diff --git a/tests/test_config.c b/tests/test_config.c</span><br><span>index 88e62bd..0d030f1 100644</span><br><span>--- a/tests/test_config.c</span><br><span>+++ b/tests/test_config.c</span><br><span>@@ -1366,12 +1366,6 @@</span><br><span> struct ao2_container *items;</span><br><span> };</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-static int test_item_hash(const void *obj, const int flags)</span><br><span style="color: hsl(0, 100%, 40%);">-{</span><br><span style="color: hsl(0, 100%, 40%);">- const struct test_item *item = obj;</span><br><span style="color: hsl(0, 100%, 40%);">- const char *name = (flags & OBJ_KEY) ? obj : item->name;</span><br><span style="color: hsl(0, 100%, 40%);">- return ast_str_case_hash(name);</span><br><span style="color: hsl(0, 100%, 40%);">-}</span><br><span> static int test_item_cmp(void *obj, void *arg, int flags)</span><br><span> {</span><br><span> struct test_item *one = obj, *two = arg;</span><br><span>@@ -1424,7 +1418,8 @@</span><br><span> if (!(cfg->global_defaults = test_item_alloc("global_defaults"))) {</span><br><span> goto error;</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- if (!(cfg->items = ao2_container_alloc(1, test_item_hash, test_item_cmp))) {</span><br><span style="color: hsl(120, 100%, 40%);">+ cfg->items = ao2_container_alloc_list(AO2_ALLOC_OPT_LOCK_MUTEX, 0, NULL, test_item_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!cfg->items) {</span><br><span> goto error;</span><br><span> }</span><br><span> return cfg;</span><br><span>diff --git a/tests/test_scoped_lock.c b/tests/test_scoped_lock.c</span><br><span>index 1881bce..0be86eb 100644</span><br><span>--- a/tests/test_scoped_lock.c</span><br><span>+++ b/tests/test_scoped_lock.c</span><br><span>@@ -199,8 +199,8 @@</span><br><span> enum ast_test_result_state res = AST_TEST_PASS;</span><br><span> struct ao2_iterator iter;</span><br><span> struct test_struct *object_iter;</span><br><span style="color: hsl(0, 100%, 40%);">- RAII_VAR(struct ao2_container*, container, ao2_container_alloc(13, NULL, NULL), ao2_cleanup);</span><br><span style="color: hsl(0, 100%, 40%);">- RAII_VAR(struct test_struct *, object, ao2_alloc(sizeof(*object), NULL), ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ao2_container*, container, NULL, ao2_cleanup);</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct test_struct *, object, NULL, ao2_cleanup);</span><br><span> </span><br><span> switch(cmd) {</span><br><span> case TEST_INIT:</span><br><span>@@ -216,6 +216,8 @@</span><br><span> }</span><br><span> current_test = test;</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ container = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0, 13, NULL, NULL, NULL);</span><br><span style="color: hsl(120, 100%, 40%);">+ object = ao2_alloc(sizeof(*object), NULL);</span><br><span> if (!object || !container) {</span><br><span> /* Allocation failure. We can't even pretend to do this test properly */</span><br><span> return AST_TEST_FAIL;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10698">change 10698</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10698"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0907d78bc66efc775672df37c8faad00f2f6c088 </div>
<div style="display:none"> Gerrit-Change-Number: 10698 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>