<p>Kevin Harwell has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/9690">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">json.c: improve ast_json_to_ast_variables performance<br><br>When converting from a json object to an ast variables list the conversion<br>algorithm was doing a complete traversal of the entire variables list for<br>every item appended from the json structure.<br><br>This patch makes it so the list is no longer traversed for each new ast<br>variable being appended.<br><br>Change-Id: I8bf496a1fc449485150d6db36bfc0354934a3977<br>---<br>M main/json.c<br>1 file changed, 2 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/90/9690/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/json.c b/main/json.c</span><br><span>index 1837b5b..0cfeac8 100644</span><br><span>--- a/main/json.c</span><br><span>+++ b/main/json.c</span><br><span>@@ -1046,6 +1046,7 @@</span><br><span> enum ast_json_to_ast_vars_code ast_json_to_ast_variables(struct ast_json *json_variables, struct ast_variable **variables)</span><br><span> {</span><br><span>        struct ast_json_iter *it_json_var;</span><br><span style="color: hsl(120, 100%, 40%);">+    struct ast_variable *tail = NULL;</span><br><span> </span><br><span>        *variables = NULL;</span><br><span> </span><br><span>@@ -1082,7 +1083,7 @@</span><br><span>                       return AST_JSON_TO_AST_VARS_CODE_OOM;</span><br><span>                }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-           ast_variable_list_append(variables, new_var);</span><br><span style="color: hsl(120, 100%, 40%);">+         tail = ast_variable_list_append_hint(variables, tail, new_var);</span><br><span>      }</span><br><span> </span><br><span>        return AST_JSON_TO_AST_VARS_CODE_SUCCESS;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/9690">change 9690</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/9690"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I8bf496a1fc449485150d6db36bfc0354934a3977 </div>
<div style="display:none"> Gerrit-Change-Number: 9690 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Kevin Harwell <kharwell@digium.com> </div>