use ast_skip_blanks() where appropriate, and use standard

C jargoon  *foo++ = '\0'; instead of two separate statements.



git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@31861 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Luigi Rizzo 2006-06-03 23:03:29 +00:00
parent b7b716b618
commit ec46b5a4ce
1 changed files with 7 additions and 15 deletions

View File

@ -10163,8 +10163,7 @@ static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
} else { } else {
e = strchr(tmp, '@'); e = strchr(tmp, '@');
if (e) { if (e) {
*e = '\0'; *e++ = '\0';
e++;
domain = e; domain = e;
} else { } else {
/* No username part */ /* No username part */
@ -11225,8 +11224,8 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
char *sep; char *sep;
if( (sep = strchr(event, ';')) ) { /* XXX bug here - overwriting string ? */ if( (sep = strchr(event, ';')) ) { /* XXX bug here - overwriting string ? */
*sep = '\0'; *sep++ = '\0';
eventid = ++sep; eventid = sep;
} }
if (option_debug > 1 && sipdebug) if (option_debug > 1 && sipdebug)
@ -11291,27 +11290,20 @@ static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, str
*/ */
if (option_debug > 2) if (option_debug > 2)
ast_log(LOG_DEBUG, "* SIP Transfer NOTIFY Attachment: \n---%s\n---\n", buf); ast_log(LOG_DEBUG, "* SIP Transfer NOTIFY Attachment: \n---%s\n---\n", buf);
cmd = buf; cmd = ast_skip_blanks(buf);
while(*cmd && (*cmd < 33)) { /* Skip white space */
cmd++;
}
code = cmd; code = cmd;
/* We are at SIP/2.0 */ /* We are at SIP/2.0 */
while(*code && (*code > 32)) { /* Search white space */ while(*code && (*code > 32)) { /* Search white space */
code++; code++;
} }
*code = '\0'; *code++ = '\0';
code++; code = ast_skip_blanks(code);
while(*code && (*code < 33)) { /* Skip white space */
code++;
}
sep = code; sep = code;
sep++; sep++;
while(*sep && (*sep > 32)) { /* Search white space */ while(*sep && (*sep > 32)) { /* Search white space */
sep++; sep++;
} }
*sep = '\0'; *sep++ = '\0'; /* Response string */
sep++; /* Response string */
respcode = atoi(code); respcode = atoi(code);
switch (respcode) { switch (respcode) {
case 100: /* Trying: */ case 100: /* Trying: */