Commit 96fa26be authored by jan.koester's avatar jan.koester
Browse files

resize function optimize

parent ef4348d5
Loading
Loading
Loading
Loading
+19 −28
Original line number Diff line number Diff line
@@ -171,13 +171,11 @@ netplus::con::condata *netplus::con::_resizeQueue(condata** firstdata, condata**

    qsize-=size;

    int temp = 0;

HAVEDATA:
    if((*firstdata)) {
        temp += ((int)(*firstdata)->getDataLength() - size);
DELETEBLOCK:
        if (temp <= 0) {
            int curlen = ((int)(*firstdata)->getDataLength() - size);

            if ( curlen <= 0 || size >= curlen) {
                size -= (*firstdata)->getDataLength();
#ifdef DEBUG
                delsize += (*firstdata)->getDataLength();
@@ -191,23 +189,16 @@ DELETEBLOCK:
                if ((*firstdata) && size > 0)
                    goto HAVEDATA;
            }else{
            int curlen = ((int)(*firstdata)->getDataLength() - size);

            if ( curlen <= 0 || size >= curlen) {
                temp -= curlen;
                goto DELETEBLOCK;
            }

                std::string buf = (*firstdata)->_Data.substr(size,curlen);
                (*firstdata)->_Data = buf;
#ifdef DEBUG
                delsize += size;
#endif
            }
            size -= curlen;
    }
    if(size!=0)
        goto HAVEDATA;
    }

#ifdef DEBUG
    std::cout << " delsize: "    << delsize << ": " << size