Browse code

core: reason phrase param updated to be str*

- build_res_buf_from_sip_req() takes reply reason phrase parameter as
str*
- many calls of this function have already the reason length

Daniel-Constantin Mierla authored on 16/08/2010 16:28:03
Showing 2 changed files
... ...
@@ -1908,7 +1908,7 @@ error:
1908 1908
 }
1909 1909
 
1910 1910
 
1911
-char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1911
+char * build_res_buf_from_sip_req( unsigned int code, str *text ,str *new_tag,
1912 1912
 		struct sip_msg* msg, unsigned int *returned_len, struct bookmark *bmark)
1913 1913
 {
1914 1914
 	char              *buf, *p;
... ...
@@ -1925,7 +1925,6 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1925 1925
 	unsigned int      warning_len;
1926 1926
 	char*             content_len_buf;
1927 1927
 	unsigned int      content_len_len;
1928
-	unsigned int      text_len;
1929 1928
 	char *after_body;
1930 1929
 	str  to_tag;
1931 1930
 	char *totags;
... ...
@@ -1935,8 +1934,6 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1935 1935
 	received_buf=rport_buf=warning_buf=content_len_buf=0;
1936 1936
 	received_len=rport_len=warning_len=content_len_len=0;
1937 1937
 
1938
-	text_len=strlen(text);
1939
-
1940 1938
 	to_tag.s=0;  /* fixes gcc 4.0 warning */
1941 1939
 	to_tag.len=0;
1942 1940
 
... ...
@@ -1975,7 +1972,7 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
1975 1975
 
1976 1976
 	/* first line */
1977 1977
 	len += msg->first_line.u.request.version.len + 1/*space*/ + 3/*code*/ + 1/*space*/ +
1978
-		text_len + CRLF_LEN/*new line*/;
1978
+		text->len + CRLF_LEN/*new line*/;
1979 1979
 	/*headers that will be copied (TO, FROM, CSEQ,CALLID,VIA)*/
1980 1980
 	for ( hdr=msg->headers ; hdr ; hdr=hdr->next ) {
1981 1981
 		switch (hdr->type) {
... ...
@@ -2055,8 +2052,8 @@ char * build_res_buf_from_sip_req( unsigned int code, char *text ,str *new_tag,
2055 2055
 		*(p+i) = '0' + foo - ( foo/10 )*10;
2056 2056
 	p += 3;
2057 2057
 	*(p++) = ' ' ;
2058
-	memcpy( p , text , text_len );
2059
-	p += text_len;
2058
+	memcpy( p , text->s , text->len );
2059
+	p += text->len;
2060 2060
 	memcpy( p, CRLF, CRLF_LEN );
2061 2061
 	p+=CRLF_LEN;
2062 2062
 	/* headers*/
... ...
@@ -80,17 +80,17 @@ struct hostport {
80 80
 			(hp)->port=&default_global_port; \
81 81
 	}while(0)
82 82
 
83
-char * build_req_buf_from_sip_req (	struct sip_msg* msg, 
83
+char * build_req_buf_from_sip_req(struct sip_msg* msg, 
84 84
 				unsigned int *returned_len, struct dest_info* send_info,
85 85
 				unsigned int mode);
86 86
 
87
-char * build_res_buf_from_sip_res(	struct sip_msg* msg,
87
+char * build_res_buf_from_sip_res(struct sip_msg* msg,
88 88
 				unsigned int *returned_len);
89 89
 
90 90
 
91
-char * build_res_buf_from_sip_req( unsigned int code ,
92
-				char *text ,
93
-				str *new_tag ,
91
+char * build_res_buf_from_sip_req(unsigned int code,
92
+				str *text,
93
+				str *new_tag,
94 94
 				struct sip_msg* msg,
95 95
 				unsigned int *returned_len,
96 96
 				struct bookmark *bmark);