<p><a href="https://gerrit.asterisk.org/10378">View Change</a></p><p>1 comment:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.asterisk.org/#/c/10378/1/include/asterisk/astobj2.h">File include/asterisk/astobj2.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.asterisk.org/#/c/10378/1/include/asterisk/astobj2.h@408">Patch Set #1, Line 408:</a> </p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;"><pre style="font-family: monospace,monospace; white-space: pre-wrap;">#define ao2_alloc_nolock(data_size, destructor_fn) \<br>       __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_NOLOCK, "",  __FILE__, __LINE__, __PRETTY_FUNCTION__)<br>#define ao2_t_alloc_nolock(data_size, destructor_fn, tag) \<br>     __ao2_alloc((data_size), (destructor_fn), AO2_ALLOC_OPT_LOCK_NOLOCK, (tag),  __FILE__, __LINE__, __PRETTY_FUNCTION__)<br></pre></blockquote></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">The allocator options are so long that it always requires wrapping the arguments. […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">It doesn't reduce readability much especially if the assignment is done outside an if test:</p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">obj = aot_alloc_options(sizeof(*obj), obj_dtor,<br>   AO2_ALLOC_OPT_LOCK_NOLOCK);<br>if (!obj) {<br>}</pre><p style="white-space: pre-wrap; word-wrap: break-word;">Besides having a blizzard of aliases for things requires you to be more cognizant of what's available when writing and reviewing.</p><p style="white-space: pre-wrap; word-wrap: break-word;">The reason ao2_alloc_options() exists at all is because of the growth of the API.  I would rather it disappeared to just become ao2_alloc().  Unfortunately, that isn't really possible because of the amount of code that would need changing.  Similar for ao2_container_alloc() and ao2_container_alloc_options() in favor of ao2_container_alloc_list(), ao2_container_alloc_hash(), and ao2_container_alloc_rbtree().</p><p style="white-space: pre-wrap; word-wrap: break-word;">So I'd rather not grow the API for trivial things like this when there are perfectly valid other calls available.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10378">change 10378</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/10378"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Ie999b9941760be3d1946cdb6e30cb85fd97504d8 </div>
<div style="display:none"> Gerrit-Change-Number: 10378 </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: Corey Farrell <git@cfware.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 02 Oct 2018 20:19:37 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-HasLabels: No </div>