Hello can you please remove the uncessary condition if (c==0 || c== 1) {} and leave only the body of that condition please and remove also the unused c variable. we dont need it.

should be like this

int tps_reappend_via_separate_header(sip_msg_t *msg, tps_data_t *ptsd, str *hbody)
{
        str hname = str_init("Via");
        int i;
        str sb;
        char *p = NULL;

        if(hbody==NULL || hbody->s==NULL || hbody->len<=0 || hbody->s[0]=='\0')
            return 0;

        sb.len = 1;
        p = hbody->s;
        for(i=0; i<hbody->len-1; i++) {
            if(hbody->s[i]==',') {
                if(sb.len>0) {
                    sb.s = p;
                    if(sb.s[sb.len-1]==',') sb.len--;
                    if(tps_add_headers(msg, &hname, &sb, 0)<0) {
                        return -1;
                    }
                }
                sb.len = 0;
                p = hbody->s + i + 1;
            }
            sb.len++;
        }


        if(sb.len>0) {
                sb.s = p;
                if(sb.s[sb.len-1]==',') sb.len--;
                if(tps_add_headers(msg, &hname, &sb, 0)<0) {
                    return -1;
                }
        }


        return 0;
}

Thanks.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <kamailio/kamailio/pull/3220/c1217546116@github.com>