mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-04 09:44:26 +00:00
Optimize switch_split_user_domain a bit
This avoids searching the string repeatedly with strchr.
This commit is contained in:
parent
1060a188ce
commit
5d706aa4fc
@ -3116,9 +3116,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;
|
||||
|
||||
/* Clean out the host part of any suffix */
|
||||
if ((p = strchr(h, ':'))) *p = '\0';
|
||||
if ((p = strchr(h, ';'))) *p = '\0';
|
||||
if ((p = strchr(h, ' '))) *p = '\0';
|
||||
for (p = h; *p; p++)
|
||||
if (*p == ':' || *p == ';' || *p == ' ') {
|
||||
*p = '\0'; break;
|
||||
}
|
||||
|
||||
if (user) *user = u;
|
||||
if (domain) *domain = h;
|
||||
|
Loading…
x
Reference in New Issue
Block a user