Browse code

- replaced memchr w/ q_memchr (inline version).

Andrei Pelinescu-Onciul authored on 16/11/2001 00:20:54
Showing 2 changed files
... ...
@@ -189,7 +189,7 @@ char* get_hdr_field(char* buf, unsigned int len, struct hdr_field* hdr)
189 189
 		/* just skip over it*/
190 190
 		hdr->body.s=tmp;
191 191
 		/* find lf*/
192
-		match=memchr(tmp, '\n', end-tmp);
192
+		match=q_memchr(tmp, '\n', end-tmp);
193 193
 		if (match){
194 194
 			/* null terminate*/
195 195
 			*match=0;
... ...
@@ -328,7 +328,7 @@ int parse_uri(char *buf, int len, struct sip_uri* uri)
328 328
 	end=buf+len;
329 329
 	memset(uri, 0, sizeof(struct sip_uri)); /* zero it all, just to be sure */
330 330
 	/* look for "sip:"*/;
331
-	next=memchr(buf, ':',  len);
331
+	next=q_memchr(buf, ':',  len);
332 332
 	if ((next==0)||(strncmp(buf,"sip",next-buf)!=0)){
333 333
 		LOG(L_DBG, "ERROR: parse_uri: bad sip uri\n");
334 334
 		ret=E_UNSPEC;
... ...
@@ -341,7 +341,7 @@ int parse_uri(char *buf, int len, struct sip_uri* uri)
341 341
 		goto error;
342 342
 	}
343 343
 	/*look for '@' */
344
-	next=memchr(buf,'@', end-buf);
344
+	next=q_memchr(buf,'@', end-buf);
345 345
 	if (next==0){
346 346
 		/* no '@' found, => no userinfo */
347 347
 		uri->user.s=0;
... ...
@@ -351,7 +351,7 @@ int parse_uri(char *buf, int len, struct sip_uri* uri)
351 351
 		/* found it */
352 352
 		user=buf;
353 353
 		/* try to find passwd */
354
-		passwd=memchr(user,':', next-user);
354
+		passwd=q_memchr(user,':', next-user);
355 355
 		if (passwd==0){
356 356
 			/* no ':' found => no password */
357 357
 			uri->passwd.s=0;
... ...
@@ -394,9 +394,9 @@ int parse_uri(char *buf, int len, struct sip_uri* uri)
394 394
 		ret=E_UNSPEC;
395 395
 		goto error;
396 396
 	}
397
-	headers=memchr(host,'?',end-host);
398
-	params=memchr(host,';',end-host);
399
-	port=memchr(host,':',end-host);
397
+	headers=q_memchr(host,'?',end-host);
398
+	params=q_memchr(host,';',end-host);
399
+	port=q_memchr(host,':',end-host);
400 400
 	host_len=(port)?port-host:(params)?params-host:(headers)?headers-host:end-host;
401 401
 	/* get host */
402 402
 	uri->host.s=malloc(host_len+1);
... ...
@@ -6,6 +6,7 @@
6 6
  */
7 7
 
8 8
 #include  "parser_f.h"
9
+#include "ut.h"
9 10
 
10 11
 /* returns pointer to next line or after the end of buffer */
11 12
 char* eat_line(char* buffer, unsigned int len)
... ...
@@ -17,7 +18,7 @@ char* eat_line(char* buffer, unsigned int len)
17 18
  		  as I do not care about CR
18 19
 	*/
19 20
 #ifdef NOCR
20
-	nl=(char *)memchr( buffer, '\n', len );
21
+	nl=(char *)q_memchr( buffer, '\n', len );
21 22
 	if ( nl ) { 
22 23
 		c=* nl;
23 24
 		if ( nl + 1 < buffer+len)  nl++;