rem: int                       i;
add: int first_via; int str_len_text; int i;  str_len_text=strlen(text);
context: char * build_res_buf_from_sip_req(	unsigned int code ,									char *text ,									struct sip_msg* msg,									unsigned int *returned_len){	char                    *buf=0, *p;	unsigned int       len,foo;	struct hdr_field  *hdr;	int                       i;	/*computes the lenght of the new response buffer*/	len = 0;	/* first line */	len += 3/*code*/ + 1/*space*/ + strlen(text) + 1/*new line*/;	/*headers that will be copied (TO, FROM, CSEQ,CALLID,VIA)*/	for ( hdr=msg->headers ; hdr ; hdr=hdr->next )		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||				hdr->type==HDR_CALLID || hdr->type==HDR_TO ||				hdr->type==HDR_CSEQ )			len += ((hdr->body.s+hdr->body.len ) - hdr->name.s ) ;	/* end of message */	len += 1; /*new line*/	/*allocating mem*/	buf = (char*) malloc( len+1 );	p=buf;	if (!buf)	{		LOG(L_ERR, "ERROR: build_res_buf_from_sip_req: out of memory\n");		goto error;	}	/* filling the buffer*/	/* first line */	for ( i=2 , foo = code  ;  i>=0  ;  i-- , foo=foo/10 )		*(p+i) = '0' + foo - ( foo/10 )*10;	p += 3;	*(p++) = ' ' ;	memcpy( p , text , strlen(text) );	p += strlen(text);	*(p++) = '\n';	/* headers*/	for ( hdr=msg->headers ; hdr ; hdr=hdr->next )		if ( hdr->type==HDR_VIA || hdr->type==HDR_FROM ||		hdr->type==HDR_CALLID || hdr->type==HDR_TO || hdr->type==HDR_CSEQ )		{			memcpy( p , msg->orig+(hdr->name.s-msg->buf) ,					((hdr->body.s+hdr->body.len ) -					hdr->name.s ) );			p += ((hdr->body.s+hdr->body.len ) - hdr->name.s );		}	*(p++) = '\n';	*(p++) = 0;	*returned_len=len;	return buf;error:	if (buf) free(buf);	*returned_len=0;	return 0;}