提交 b5d8ffcb authored 作者: Andrey Volk's avatar Andrey Volk

FS-11903: Fix errors reported by PVS-Studio Static Code Analyzer for switch_regex.c

上级 04c8e061
......@@ -75,7 +75,7 @@ SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expressi
if (*expression == '/') {
char *opts = NULL;
tmp = strdup(expression + 1);
assert(tmp);
switch_assert(tmp);
if ((opts = strrchr(tmp, '/'))) {
*opts++ = '\0';
} else {
......@@ -85,7 +85,7 @@ SWITCH_DECLARE(int) switch_regex_perform(const char *field, const char *expressi
goto end;
}
expression = tmp;
if (opts) {
if (*opts) {
if (strchr(opts, 'i')) {
flags |= PCRE_CASELESS;
}
......@@ -227,7 +227,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, c
if (*expression == '/') {
char *opts = NULL;
tmp = strdup(expression + 1);
assert(tmp);
switch_assert(tmp);
if ((opts = strrchr(tmp, '/'))) {
*opts++ = '\0';
} else {
......@@ -237,7 +237,7 @@ SWITCH_DECLARE(switch_status_t) switch_regex_match_partial(const char *target, c
goto end;
}
expression = tmp;
if (opts) {
if (*opts) {
if (strchr(opts, 'i')) {
flags |= PCRE_CASELESS;
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论