Changeset 12311


Ignore:
Timestamp:
Apr 5, 2011, 12:53:57 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) use alloca() for allocating the block array in updateBlockRequests()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/peer-msgs.c

    r12304 r12311  
    1616#include <stdlib.h>
    1717#include <string.h>
     18
     19#include <alloca.h>
    1820
    1921#include <event2/buffer.h>
     
    17441746        int n;
    17451747        const int numwant = msgs->desiredRequestCount - msgs->peer->pendingReqsToPeer;
    1746         tr_block_index_t * blocks = tr_new( tr_block_index_t, numwant );
     1748        tr_block_index_t * blocks = alloca( sizeof( tr_block_index_t ) * numwant );
    17471749
    17481750        tr_peerMgrGetNextRequests( msgs->torrent, msgs->peer, numwant, blocks, &n );
     
    17541756            protocolSendRequest( msgs, &req );
    17551757        }
    1756 
    1757         tr_free( blocks );
    17581758    }
    17591759}
Note: See TracChangeset for help on using the changeset viewer.