rem: DBG("AVP <%i>: %x\n",avp_name.n,(unsigned int)avp);
add: DBG("AVP <%i>: %p\n",avp_name.n,avp);
context: static inline char* append2buf( char *buf, int len, struct sip_msg *req, 				struct hdr_avp *ha){	struct hdr_field *hdr;	struct usr_avp   *avp;	int_str          avp_val;	int_str          avp_name;	char  *end;	str   foo;	int   msg_parsed;	end = buf+len;	msg_parsed = 0;	while(ha) {		if (ha->type==ELEM_IS_AVP) {			/* search for the AVP */			if (ha->sval.s) {				avp_name.s=&ha->sval;				avp = search_first_avp( AVP_NAME_STR, avp_name, &avp_val);				DBG("AVP <%.*s>: %x\n",avp_name.s->len,avp_name.s->s,(unsigned int)avp);			} else {				avp_name.n=ha->ival;				avp = search_first_avp( 0, avp_name, &avp_val);				DBG("AVP <%i>: %x\n",avp_name.n,(unsigned int)avp);			}			if (avp) {				if (avp->flags&AVP_VAL_STR) {					buf=add2buf( buf, end, ha->title.s, ha->title.len,						avp_val.s->s , avp_val.s->len);					if (!buf)						goto overflow_err;				} else {					foo.s=int2str( (unsigned long)avp_val.n, &foo.len);					buf=add2buf( buf, end, ha->title.s, ha->title.len,						foo.s , foo.len);					if (!buf)						goto overflow_err;				}			}		} else if (ha->type==ELEM_IS_HDR) {			/* parse the HDRs */			if (!msg_parsed) {				if (parse_headers( req, HDR_EOH_F, 0)!=0) {					LOG(L_ERR,"ERROR:tm:append2buf: parsing hdrs failed\n");					goto error;				}				msg_parsed = 1;			}			/* search the HDR */			if (ha->ival==HDR_OTHER_T) {				for(hdr=req->headers;hdr;hdr=hdr->next)					if (ha->sval.len==hdr->name.len &&					strncasecmp( ha->sval.s, hdr->name.s, hdr->name.len)==0)						break;			} else {				for(hdr=req->headers;hdr;hdr=hdr->next)					if (ha->ival==hdr->type)						break;			}			if (hdr) {				trim_len( foo.len, foo.s, hdr->body);				buf=add2buf( buf, end, ha->title.s, ha->title.len,					foo.s , foo.len);				if (!buf)					goto overflow_err;			}		} else {			LOG(L_ERR,"BUG:tm:append2buf: unknown element type %d\n",				ha->type);			goto error;		}		ha = ha->next;	}	return buf;overflow_err:	LOG(L_ERR,"ERROR:tm:append2buf: overflow -> append exceeded %d len\n",len);error:	return 0;}