提交 164d6a7b authored 作者: Travis Cross's avatar Travis Cross

Optimize switch_split_user_domain a bit

This avoids searching the string repeatedly with strchr.
上级 5aab272b
...@@ -3127,9 +3127,10 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai ...@@ -3127,9 +3127,10 @@ SWITCH_DECLARE(int) switch_split_user_domain(char *in, char **user, char **domai
if ((h = in, p = strchr(h, '@'))) *p = '\0', u = in, h = p+1; if ((h = in, p = strchr(h, '@'))) *p = '\0', u = in, h = p+1;
/* Clean out the host part of any suffix */ /* Clean out the host part of any suffix */
if ((p = strchr(h, ':'))) *p = '\0'; for (p = h; *p; p++)
if ((p = strchr(h, ';'))) *p = '\0'; if (*p == ':' || *p == ';' || *p == ' ') {
if ((p = strchr(h, ' '))) *p = '\0'; *p = '\0'; break;
}
if (user) *user = u; if (user) *user = u;
if (domain) *domain = h; if (domain) *domain = h;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论