<p>Joshua C. Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/11121">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Joshua C. Colp: Looks good to me, but someone else must approve; Approved for Submit
Kevin Harwell: Looks good to me, approved
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_musiconhold: Remove redundant option parsing<br><br>Change-Id: I481fabd8eaf2e4e7ffb5c8285b294742826e7d12<br>---<br>M res/res_musiconhold.c<br>1 file changed, 19 insertions(+), 43 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_musiconhold.c b/res/res_musiconhold.c</span><br><span>index d14e209..8fc58a1 100644</span><br><span>--- a/res/res_musiconhold.c</span><br><span>+++ b/res/res_musiconhold.c</span><br><span>@@ -1088,6 +1088,9 @@</span><br><span> ast_copy_string(mohclass->dir, var->value, sizeof(mohclass->dir));</span><br><span> } else if (!strcasecmp(var->name, "application")) {</span><br><span> ast_copy_string(mohclass->args, var->value, sizeof(mohclass->args));</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strcasecmp(var->name, "announcement")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_copy_string(mohclass->announcement, var->value, sizeof(mohclass->announcement));</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_set_flag(mohclass, MOH_ANNOUNCEMENT);</span><br><span> } else if (!strcasecmp(var->name, "digit") && (isdigit(*var->value) || strchr("*#", *var->value))) {</span><br><span> mohclass->digit = *var->value;</span><br><span> } else if (!strcasecmp(var->name, "random")) {</span><br><span>@@ -1112,6 +1115,22 @@</span><br><span> ast_log(LOG_WARNING, "Unknown format '%s' -- defaulting to SLIN\n", var->value);</span><br><span> mohclass->format = ao2_bump(ast_format_slin);</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strcasecmp(var->name, "kill_escalation_delay")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (sscanf(var->value, "%zu", &mohclass->kill_delay) == 1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ mohclass->kill_delay *= 1000;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "kill_escalation_delay '%s' is invalid. Setting to 100ms\n", var->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ mohclass->kill_delay = 100000;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strcasecmp(var->name, "kill_method")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ if (!strcasecmp(var->value, "process")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ mohclass->kill_method = KILL_METHOD_PROCESS;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else if (!strcasecmp(var->value, "process_group")) {</span><br><span style="color: hsl(120, 100%, 40%);">+ mohclass->kill_method = KILL_METHOD_PROCESS_GROUP;</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "kill_method '%s' is invalid. Setting to 'process_group'\n", var->value);</span><br><span style="color: hsl(120, 100%, 40%);">+ mohclass->kill_method = KILL_METHOD_PROCESS_GROUP;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span> }</span><br><span> }</span><br><span> }</span><br><span>@@ -1778,49 +1797,6 @@</span><br><span> /* For compatibility with the past, we overwrite any name=name</span><br><span> * with the context [name]. */</span><br><span> ast_copy_string(class->name, cat, sizeof(class->name));</span><br><span style="color: hsl(0, 100%, 40%);">- for (var = ast_variable_browse(cfg, cat); var; var = var->next) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(var->name, "mode")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(class->mode, var->value, sizeof(class->mode));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "directory")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(class->dir, var->value, sizeof(class->dir));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "application")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(class->args, var->value, sizeof(class->args));</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "announcement")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_copy_string(class->announcement, var->value, sizeof(class->announcement));</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(class, MOH_ANNOUNCEMENT);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "digit") && (isdigit(*var->value) || strchr("*#", *var->value))) {</span><br><span style="color: hsl(0, 100%, 40%);">- class->digit = *var->value;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "random")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set2_flag(class, ast_true(var->value), MOH_RANDOMIZE);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "sort") && !strcasecmp(var->value, "random")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(class, MOH_RANDOMIZE);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "sort") && !strcasecmp(var->value, "alpha")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_set_flag(class, MOH_SORTALPHA);</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "format")) {</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_cleanup(class->format);</span><br><span style="color: hsl(0, 100%, 40%);">- class->format = ast_format_cache_get(var->value);</span><br><span style="color: hsl(0, 100%, 40%);">- if (!class->format) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "Unknown format '%s' -- defaulting to SLIN\n", var->value);</span><br><span style="color: hsl(0, 100%, 40%);">- class->format = ao2_bump(ast_format_slin);</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "kill_escalation_delay")) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (sscanf(var->value, "%zu", &class->kill_delay) == 1) {</span><br><span style="color: hsl(0, 100%, 40%);">- class->kill_delay *= 1000;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "kill_escalation_delay '%s' is invalid. Setting to 100ms\n", var->value);</span><br><span style="color: hsl(0, 100%, 40%);">- class->kill_delay = 100000;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->name, "kill_method")) {</span><br><span style="color: hsl(0, 100%, 40%);">- if (!strcasecmp(var->value, "process")) {</span><br><span style="color: hsl(0, 100%, 40%);">- class->kill_method = KILL_METHOD_PROCESS;</span><br><span style="color: hsl(0, 100%, 40%);">- } else if (!strcasecmp(var->value, "process_group")){</span><br><span style="color: hsl(0, 100%, 40%);">- class->kill_method = KILL_METHOD_PROCESS_GROUP;</span><br><span style="color: hsl(0, 100%, 40%);">- } else {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_WARNING, "kill_method '%s' is invalid. Setting to 'process_group'\n", var->value);</span><br><span style="color: hsl(0, 100%, 40%);">- class->kill_method = KILL_METHOD_PROCESS_GROUP;</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span style="color: hsl(0, 100%, 40%);">- }</span><br><span> </span><br><span> if (ast_strlen_zero(class->dir)) {</span><br><span> if (!strcasecmp(class->mode, "custom")) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/11121">change 11121</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/c/asterisk/+/11121"/><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-Change-Id: I481fabd8eaf2e4e7ffb5c8285b294742826e7d12 </div>
<div style="display:none"> Gerrit-Change-Number: 11121 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>