Move loop exit conditionals

The net effect here is the code looks more "regular" and reads more
linearly.
This commit is contained in:
Travis Cross 2014-04-09 07:40:18 +00:00
parent 4a8dace5ab
commit b72194b72b
1 changed files with 5 additions and 5 deletions

View File

@ -171,7 +171,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
goto done; goto done;
} }
while (input && !done) { while (input) {
char *field = (char *) switch_xml_attr(input, "field"); char *field = (char *) switch_xml_attr(input, "field");
char *pattern = (char *) switch_xml_attr(input, "pattern"); char *pattern = (char *) switch_xml_attr(input, "pattern");
const char *do_break = switch_xml_attr_soft(input, "break_on_match"); const char *do_break = switch_xml_attr_soft(input, "break_on_match");
@ -212,7 +212,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
if (match) { if (match) {
matches++; matches++;
for (action = switch_xml_child(match, "action"); action && status == SWITCH_STATUS_SUCCESS; action = action->next) { for (action = switch_xml_child(match, "action"); action; action = action->next) {
char *adata = (char *) switch_xml_attr_soft(action, "data"); char *adata = (char *) switch_xml_attr_soft(action, "data");
char *func = (char *) switch_xml_attr_soft(action, "function"); char *func = (char *) switch_xml_attr_soft(action, "function");
char *substituted = NULL; char *substituted = NULL;
@ -312,15 +312,15 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_phrase_macro_event(switch_core_sessio
switch_ivr_sleep(session, pause, SWITCH_FALSE, NULL); switch_ivr_sleep(session, pause, SWITCH_FALSE, NULL);
switch_safe_free(expanded); switch_safe_free(expanded);
switch_safe_free(substituted); switch_safe_free(substituted);
if (done) break; if (done || status != SWITCH_STATUS_SUCCESS) break;
} }
} }
switch_regex_safe_free(re); switch_regex_safe_free(re);
switch_safe_free(field_expanded_alloc); switch_safe_free(field_expanded_alloc);
if ((match && do_break && switch_true(do_break)) if (done || status != SWITCH_STATUS_SUCCESS
|| status != SWITCH_STATUS_SUCCESS) { || (match && do_break && switch_true(do_break))) {
break; break;
} }