<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6744">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Richard Mudgett: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">named_locks: Use ao2_weakproxy_find.<br><br>Change-Id: I0ce8a1b7101b6caac6a19f83a89f00eaba1e9d9c<br>---<br>M main/named_locks.c<br>1 file changed, 7 insertions(+), 17 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/main/named_locks.c b/main/named_locks.c<br>index 92b8262..6bec8f9 100644<br>--- a/main/named_locks.c<br>+++ b/main/named_locks.c<br>@@ -110,31 +110,21 @@<br> struct ast_named_lock *__ast_named_lock_get(const char *filename, int lineno, const char *func,<br> enum ast_named_lock_type lock_type, const char *keyspace, const char *key)<br> {<br>- struct named_lock_proxy *proxy = NULL;<br>- struct ast_named_lock *lock = NULL;<br>+ struct named_lock_proxy *proxy;<br>+ struct ast_named_lock *lock;<br> int keylen = strlen(keyspace) + strlen(key) + 2;<br> char *concat_key = ast_alloca(keylen);<br> <br> sprintf(concat_key, "%s-%s", keyspace, key); /* Safe */<br> <br> ao2_lock(named_locks);<br>- proxy = ao2_find(named_locks, concat_key, OBJ_SEARCH_KEY | OBJ_NOLOCK);<br>- if (proxy) {<br>+ lock = __ao2_weakproxy_find(named_locks, concat_key, OBJ_SEARCH_KEY | OBJ_NOLOCK,<br>+ __PRETTY_FUNCTION__, filename, lineno, func);<br>+ if (lock) {<br>+ ast_assert((ao2_options_get(lock) & AO2_ALLOC_OPT_LOCK_MASK) == lock_type);<br> ao2_unlock(named_locks);<br>- lock = __ao2_weakproxy_get_object(proxy, 0, __PRETTY_FUNCTION__, filename, lineno, func);<br> <br>- if (lock) {<br>- /* We have an existing lock and it's not being destroyed. */<br>- ao2_ref(proxy, -1);<br>- ast_assert((ao2_options_get(lock) & AO2_ALLOC_OPT_LOCK_MASK) == lock_type);<br>-<br>- return lock;<br>- }<br>-<br>- /* the old proxy is being destroyed, clean list before creating/adding new one */<br>- ao2_lock(named_locks);<br>- ao2_unlink_flags(named_locks, proxy, OBJ_NOLOCK);<br>- ao2_ref(proxy, -1);<br>+ return lock;<br> }<br> <br> proxy = ao2_t_weakproxy_alloc(sizeof(*proxy) + keylen, NULL, concat_key);<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6744">change 6744</a>. To unsubscribe, 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/6744"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 14 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I0ce8a1b7101b6caac6a19f83a89f00eaba1e9d9c </div>
<div style="display:none"> Gerrit-Change-Number: 6744 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>