Module: sip-router
Branch: master
Commit: 1226a51d817481e6ebde455e10e0949987fe45e9
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=1226a51…
Author: Juha Heinanen <jh(a)tutpro.com>
Committer: Juha Heinanen <jh(a)tutpro.com>
Date: Sun Dec 4 13:42:16 2011 +0200
modules_k/siputils: faster implementation of is_uri_user_e164 test
---
modules_k/siputils/checks.c | 14 ++++++++++----
1 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/modules_k/siputils/checks.c b/modules_k/siputils/checks.c
index 52db0ae..eb04e50 100644
--- a/modules_k/siputils/checks.c
+++ b/modules_k/siputils/checks.c
@@ -494,14 +494,20 @@ int w_is_uri_user_e164(struct sip_msg* _m, char* _sp, char* _s2)
int is_uri_user_e164(struct sip_msg *msg, str *uri)
{
- struct sip_uri puri;
+ char *chr;
+ str user;
- if (parse_uri(uri->s, uri->len, &puri) < 0) {
+ chr = memchr(uri->s, ':', uri->len);
+ if (chr == NULL) {
LM_ERR("parsing URI failed\n");
return -1;
- }
+ };
+ user.s = chr + 1;
+ chr = memchr(user.s, '@', uri->len - (user.s - uri->s));
+ if (chr == NULL) return -1;
+ user.len = chr - user.s;
- return e164_check(&(puri.user));
+ return e164_check(&user);
}
/*