<p>Corey Farrell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10699">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/datastore.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/ari/resource_events.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_exten_state.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>67 files changed, 321 insertions(+), 219 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/99/10699/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 5936400..ad871e0 100644</span><br><span>--- a/apps/app_confbridge.c</span><br><span>+++ b/apps/app_confbridge.c</span><br><span>@@ -4196,8 +4196,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 40c0bd2..6984bd2 100644</span><br><span>--- a/apps/app_meetme.c</span><br><span>+++ b/apps/app_meetme.c</span><br><span>@@ -1624,8 +1624,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>@@ -7395,13 +7401,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>@@ -7409,13 +7408,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>@@ -7869,8 +7861,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 b299889..b4613c3 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -2815,9 +2815,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>@@ -11254,13 +11255,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 e58f625..e0b8bca 100644</span><br><span>--- a/apps/app_skel.c</span><br><span>+++ b/apps/app_skel.c</span><br><span>@@ -580,7 +580,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>@@ -725,7 +727,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 554363a..595c2dc 100644</span><br><span>--- a/apps/app_voicemail.c</span><br><span>+++ b/apps/app_voicemail.c</span><br><span>@@ -15066,11 +15066,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 9e56b36..53061ba 100644</span><br><span>--- a/apps/confbridge/conf_config_parser.c</span><br><span>+++ b/apps/confbridge/conf_config_parser.c</span><br><span>@@ -1987,15 +1987,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 7692b26..9113ffa 100644</span><br><span>--- a/channels/chan_console.c</span><br><span>+++ b/channels/chan_console.c</span><br><span>@@ -1534,7 +1534,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 0ca4234..6f88d09 100644</span><br><span>--- a/channels/chan_iax2.c</span><br><span>+++ b/channels/chan_iax2.c</span><br><span>@@ -14714,23 +14714,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 05184ca..a9dd2af 100644</span><br><span>--- a/channels/chan_motif.c</span><br><span>+++ b/channels/chan_motif.c</span><br><span>@@ -471,7 +471,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>@@ -601,7 +603,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 9089b5e..3be80d5 100644</span><br><span>--- a/channels/chan_sip.c</span><br><span>+++ b/channels/chan_sip.c</span><br><span>@@ -1815,8 +1815,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>@@ -35517,7 +35518,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 28d84ee..7051961 100644</span><br><span>--- a/channels/chan_unistim.c</span><br><span>+++ b/channels/chan_unistim.c</span><br><span>@@ -813,7 +813,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 ec6d666..3675b0e 100644</span><br><span>--- a/channels/sig_pri.c</span><br><span>+++ b/channels/sig_pri.c</span><br><span>@@ -10133,8 +10133,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 e578000..9a98b3c 100644</span><br><span>--- a/funcs/func_dialgroup.c</span><br><span>+++ b/funcs/func_dialgroup.c</span><br><span>@@ -221,7 +221,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>@@ -236,7 +237,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>@@ -297,7 +300,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 5cb8310..acb5fc9 100644</span><br><span>--- a/funcs/func_lock.c</span><br><span>+++ b/funcs/func_lock.c</span><br><span>@@ -215,12 +215,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>@@ -296,7 +290,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(&current->mutex);</span><br><span>                   ast_cond_destroy(&current->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 66722df..9a124c1 100644</span><br><span>--- a/funcs/func_odbc.c</span><br><span>+++ b/funcs/func_odbc.c</span><br><span>@@ -1793,7 +1793,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>@@ -1891,7 +1892,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 2910304..beba26e 100644</span><br><span>--- a/include/asterisk/astobj2.h</span><br><span>+++ b/include/asterisk/astobj2.h</span><br><span>@@ -93,7 +93,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>@@ -109,7 +110,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>@@ -936,20 +937,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>@@ -1297,6 +1286,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>@@ -1316,17 +1309,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 0ec728e..feb3bee 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,</span><br><span style="color: hsl(120, 100%, 40%);">+             NUM_APP_BUCKETS, 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 AST_MODULE_LOAD_FAILURE;</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 AST_MODULE_LOAD_FAILURE;</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 a72439c..6c6e9f7 100644</span><br><span>--- a/main/channel.c</span><br><span>+++ b/main/channel.c</span><br><span>@@ -7856,8 +7856,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 b926514..a963a7d 100644</span><br><span>--- a/main/channel_internal_api.c</span><br><span>+++ b/main/channel_internal_api.c</span><br><span>@@ -1302,7 +1302,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 1961b24..f694c2b 100644</span><br><span>--- a/main/config.c</span><br><span>+++ b/main/config.c</span><br><span>@@ -2536,7 +2536,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>@@ -4104,8 +4105,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 2d5e09c..cbd7622 100644</span><br><span>--- a/main/config_options.c</span><br><span>+++ b/main/config_options.c</span><br><span>@@ -405,7 +405,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/datastore.c b/main/datastore.c</span><br><span>index 5edad24..f37ee6c 100644</span><br><span>--- a/main/datastore.c</span><br><span>+++ b/main/datastore.c</span><br><span>@@ -94,7 +94,8 @@</span><br><span> </span><br><span> struct ao2_container *ast_datastores_alloc(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-     return ao2_container_alloc(DATASTORE_BUCKETS, ast_datastore_hash_fn, ast_datastore_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+   return ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+          DATASTORE_BUCKETS, ast_datastore_hash_fn, NULL, ast_datastore_cmp_fn);</span><br><span> }</span><br><span> </span><br><span> int ast_datastores_add(struct ao2_container *datastores, struct ast_datastore *datastore)</span><br><span>diff --git a/main/endpoints.c b/main/endpoints.c</span><br><span>index 3129fb4..030e26c 100644</span><br><span>--- a/main/endpoints.c</span><br><span>+++ b/main/endpoints.c</span><br><span>@@ -482,14 +482,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 77755a9..1f77ca1 100644</span><br><span>--- a/main/indications.c</span><br><span>+++ b/main/indications.c</span><br><span>@@ -1133,8 +1133,8 @@</span><br><span> /*! \brief Load indications module */</span><br><span> static int load_module(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 AST_MODULE_LOAD_FAILURE;</span><br><span>      }</span><br><span>diff --git a/main/manager.c b/main/manager.c</span><br><span>index 0da023a..0469a73 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>@@ -7639,7 +7639,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>@@ -9067,7 +9068,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>@@ -9323,8 +9324,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 b7d14f1..4874162 100644</span><br><span>--- a/main/message.c</span><br><span>+++ b/main/message.c</span><br><span>@@ -367,12 +367,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>@@ -406,7 +400,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 8cf09c2..8e9da3a 100644</span><br><span>--- a/main/named_acl.c</span><br><span>+++ b/main/named_acl.c</span><br><span>@@ -131,7 +131,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 0a23735..9e19f35 100644</span><br><span>--- a/main/pbx.c</span><br><span>+++ b/main/pbx.c</span><br><span>@@ -3953,7 +3953,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>@@ -8912,11 +8912,13 @@</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>@@ -8926,7 +8928,7 @@</span><br><span>    if (autohints) {</span><br><span>             ao2_container_register("autohints", autohints, print_autohint_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 93112d9..f4b992e 100644</span><br><span>--- a/main/stasis.c</span><br><span>+++ b/main/stasis.c</span><br><span>@@ -1283,8 +1283,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 8041c8e..0da8005 100644</span><br><span>--- a/main/stasis_channels.c</span><br><span>+++ b/main/stasis_channels.c</span><br><span>@@ -615,8 +615,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>@@ -719,8 +719,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 68bd29c..30aeddb 100644</span><br><span>--- a/main/taskprocessor.c</span><br><span>+++ b/main/taskprocessor.c</span><br><span>@@ -278,7 +278,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 43ae074..8b273f0 100644</span><br><span>--- a/main/xmldoc.c</span><br><span>+++ b/main/xmldoc.c</span><br><span>@@ -2657,7 +2657,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 29d2e08..75e6654 100644</span><br><span>--- a/pbx/pbx_realtime.c</span><br><span>+++ b/pbx/pbx_realtime.c</span><br><span>@@ -401,7 +401,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/ari/resource_events.c b/res/ari/resource_events.c</span><br><span>index 5a8e898..5983f7b 100644</span><br><span>--- a/res/ari/resource_events.c</span><br><span>+++ b/res/ari/resource_events.c</span><br><span>@@ -467,9 +467,8 @@</span><br><span> int ast_ari_websocket_events_event_websocket_init(void)</span><br><span> {</span><br><span>         /* Try to instantiate the registry */</span><br><span style="color: hsl(0, 100%, 40%);">-   event_session_registry = ao2_container_alloc(EVENT_SESSION_NUM_BUCKETS,</span><br><span style="color: hsl(0, 100%, 40%);">-                                              event_session_hash,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                     event_session_compare);</span><br><span style="color: hsl(120, 100%, 40%);">+  event_session_registry = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+                EVENT_SESSION_NUM_BUCKETS, event_session_hash, NULL, event_session_compare);</span><br><span>         if (!event_session_registry) {</span><br><span>               /* This is bad, bad. */</span><br><span>              ast_log(LOG_WARNING,</span><br><span>diff --git a/res/res_calendar.c b/res/res_calendar.c</span><br><span>index c46307f..f629e3d 100644</span><br><span>--- a/res/res_calendar.c</span><br><span>+++ b/res/res_calendar.c</span><br><span>@@ -415,7 +415,9 @@</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 = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+                        CALENDAR_BUCKETS, event_hash_fn, NULL, event_cmp_fn);</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>@@ -686,7 +688,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>@@ -1896,7 +1899,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 eaf9b9f..9658c17 100644</span><br><span>--- a/res/res_clialiases.c</span><br><span>+++ b/res/res_clialiases.c</span><br><span>@@ -282,7 +282,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 854034f..6446f17 100644</span><br><span>--- a/res/res_config_sqlite3.c</span><br><span>+++ b/res/res_config_sqlite3.c</span><br><span>@@ -1194,7 +1194,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>@@ -1369,7 +1371,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 50dd510..bf172e3 100644</span><br><span>--- a/res/res_corosync.c</span><br><span>+++ b/res/res_corosync.c</span><br><span>@@ -1125,7 +1125,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 f03fdc9..39a7a64 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 d64ecba..0b75721 100644</span><br><span>--- a/res/res_http_websocket.c</span><br><span>+++ b/res/res_http_websocket.c</span><br><span>@@ -147,7 +147,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 1c82e3f..a9fe7c7 100644</span><br><span>--- a/res/res_odbc.c</span><br><span>+++ b/res/res_odbc.c</span><br><span>@@ -178,11 +178,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>@@ -1001,7 +996,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>      }</span><br><span> </span><br><span>diff --git a/res/res_parking.c b/res/res_parking.c</span><br><span>index 5d1b30c..afde599 100644</span><br><span>--- a/res/res_parking.c</span><br><span>+++ b/res/res_parking.c</span><br><span>@@ -385,7 +385,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 70e1333..9b26ab2 100644</span><br><span>--- a/res/res_phoneprov.c</span><br><span>+++ b/res/res_phoneprov.c</span><br><span>@@ -1413,13 +1413,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>@@ -1430,13 +1432,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 13a9ff8..3b86df9 100644</span><br><span>--- a/res/res_pjsip/config_transport.c</span><br><span>+++ b/res/res_pjsip/config_transport.c</span><br><span>@@ -1377,7 +1377,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>@@ -1394,7 +1395,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 efacb58..a3cfde9 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_exten_state.c b/res/res_pjsip_exten_state.c</span><br><span>index 47ec8b4..df9a35f 100644</span><br><span>--- a/res/res_pjsip_exten_state.c</span><br><span>+++ b/res/res_pjsip_exten_state.c</span><br><span>@@ -959,8 +959,8 @@</span><br><span> </span><br><span> static int load_module(void)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- publishers = ao2_container_alloc(PUBLISHER_BUCKETS, exten_state_publisher_hash,</span><br><span style="color: hsl(0, 100%, 40%);">-         exten_state_publisher_cmp);</span><br><span style="color: hsl(120, 100%, 40%);">+   publishers = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+            PUBLISHER_BUCKETS, exten_state_publisher_hash, NULL, exten_state_publisher_cmp);</span><br><span>     if (!publishers) {</span><br><span>           ast_log(LOG_WARNING, "Unable to create container to store extension state publishers\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 83bff88..eeb8a18 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 e4e9fd4..242e43f 100644</span><br><span>--- a/res/res_pjsip_outbound_publish.c</span><br><span>+++ b/res/res_pjsip_outbound_publish.c</span><br><span>@@ -1435,14 +1435,16 @@</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>         }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-   state->client->publishers = ao2_container_alloc(DATASTORE_BUCKETS, sip_outbound_publisher_hash_fn,</span><br><span style="color: hsl(0, 100%, 40%);">-                                                        sip_outbound_publisher_cmp_fn);</span><br><span style="color: hsl(120, 100%, 40%);">+       state->client->publishers = ao2_container_alloc_hash(AO2_ALLOC_OPT_LOCK_MUTEX, 0,</span><br><span style="color: hsl(120, 100%, 40%);">+               DATASTORE_BUCKETS,</span><br><span style="color: hsl(120, 100%, 40%);">+            sip_outbound_publisher_hash_fn, NULL, sip_outbound_publisher_cmp_fn);</span><br><span>        if (!state->client->publishers) {</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 7aba734..efeae23 100644</span><br><span>--- a/res/res_pjsip_outbound_registration.c</span><br><span>+++ b/res/res_pjsip_outbound_registration.c</span><br><span>@@ -2194,8 +2194,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 9e8a32b..394b1ac 100644</span><br><span>--- a/res/res_pjsip_pubsub.c</span><br><span>+++ b/res/res_pjsip_pubsub.c</span><br><span>@@ -2676,8 +2676,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>diff --git a/res/res_pjsip_session.c b/res/res_pjsip_session.c</span><br><span>index 13c123a..0df0141 100644</span><br><span>--- a/res/res_pjsip_session.c</span><br><span>+++ b/res/res_pjsip_session.c</span><br><span>@@ -2181,7 +2181,8 @@</span><br><span>  if (!session->direct_media_cap) {</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>@@ -4266,8 +4267,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 465f9bc..00d8883 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -686,9 +686,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>@@ -1103,8 +1106,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 6c91dad..1e8bef9 100644</span><br><span>--- a/res/res_sorcery_memory.c</span><br><span>+++ b/res/res_sorcery_memory.c</span><br><span>@@ -250,7 +250,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 82d8792..704d779 100644</span><br><span>--- a/res/res_stasis.c</span><br><span>+++ b/res/res_stasis.c</span><br><span>@@ -2167,9 +2167,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 1c80f9e..71b9c15 100644</span><br><span>--- a/res/res_stasis_device_state.c</span><br><span>+++ b/res/res_stasis_device_state.c</span><br><span>@@ -461,9 +461,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 a25a300..4a8e84d 100644</span><br><span>--- a/res/res_stasis_playback.c</span><br><span>+++ b/res/res_stasis_playback.c</span><br><span>@@ -738,8 +738,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 755bdcf..4077fc8 100644</span><br><span>--- a/res/res_stasis_recording.c</span><br><span>+++ b/res/res_stasis_recording.c</span><br><span>@@ -634,8 +634,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 bcc9eb0..c101579 100644</span><br><span>--- a/res/res_timing_pthread.c</span><br><span>+++ b/res/res_timing_pthread.c</span><br><span>@@ -440,8 +440,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 7d032ad..3a2d749 100644</span><br><span>--- a/res/res_xmpp.c</span><br><span>+++ b/res/res_xmpp.c</span><br><span>@@ -641,7 +641,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>@@ -707,7 +709,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>@@ -725,14 +729,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>@@ -754,7 +750,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>@@ -2254,7 +2252,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 4abe28a..399cdc0 100644</span><br><span>--- a/tests/test_astobj2.c</span><br><span>+++ b/tests/test_astobj2.c</span><br><span>@@ -459,7 +459,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>@@ -712,9 +712,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 a359246..8a7e64c 100644</span><br><span>--- a/tests/test_astobj2_thrash.c</span><br><span>+++ b/tests/test_astobj2_thrash.c</span><br><span>@@ -267,8 +267,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 c9ceaf9..0b17d48 100644</span><br><span>--- a/tests/test_cel.c</span><br><span>+++ b/tests/test_cel.c</span><br><span>@@ -1837,8 +1837,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 e00b30b..c429bbe 100644</span><br><span>--- a/tests/test_config.c</span><br><span>+++ b/tests/test_config.c</span><br><span>@@ -1364,12 +1364,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>@@ -1422,7 +1416,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/10699">change 10699</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/10699"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </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: 10699 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>