]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-4144 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Fri, 27 Apr 2012 20:28:17 +0000 (15:28 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Fri, 27 Apr 2012 20:28:17 +0000 (15:28 -0500)
src/mod/applications/mod_commands/mod_commands.c

index 289f6d3b0216475cbe85f09873741c07db3e203e..9baa7ce0f1b43e031e68e0043b03f88c0ce12ce2 100644 (file)
@@ -1559,27 +1559,22 @@ SWITCH_STANDARD_API(regex_function)
                goto error;
        }
 
-       if ((proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0])))) {
-               if (argc > 2) {
-                       len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed;
-                       substituted = malloc(len);
-                       switch_assert(substituted);
-                       memset(substituted, 0, len);
-                       switch_replace_char(argv[2], '%', '$', SWITCH_FALSE);
-                       switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector);
-
-                       stream->write_function(stream, "%s", substituted);
-                       free(substituted);
-               } else {
-                       stream->write_function(stream, "true");
-               }
+       proceed = switch_regex_perform(argv[0], argv[1], &re, ovector, sizeof(ovector) / sizeof(ovector[0]));
+
+       if (argc > 2) {
+               len = (strlen(argv[0]) + strlen(argv[2]) + 10) * proceed;
+               substituted = malloc(len);
+               switch_assert(substituted);
+               memset(substituted, 0, len);
+               switch_replace_char(argv[2], '%', '$', SWITCH_FALSE);
+               switch_perform_substitution(re, proceed, argv[2], argv[0], substituted, len, ovector);
+
+               stream->write_function(stream, "%s", substituted);
+               free(substituted);
        } else {
-               if (argc > 2) {
-                       stream->write_function(stream, "%s", argv[0]);
-               } else {
-                       stream->write_function(stream, "false");
-               }
+               stream->write_function(stream, proceed ? "true" : "false");
        }
+
        goto ok;
 
   error: