Ignore:
Timestamp:
Dec 30, 2008, 12:56:10 AM (12 years ago)
Author:
charles
Message:

(trunk libT) avoid a few more unnecessary malloc() + free() pairs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/tracker.c

    r7533 r7535  
    729729    int                 reqtype; /* TR_REQ_* */
    730730    int                 torrentId;
    731     char *              url;
    732     tr_web_done_func * done_func;
     731    struct evbuffer   * url;
     732    tr_web_done_func  * done_func;
    733733    tr_session *        session;
    734734};
     
    737737freeRequest( struct tr_tracker_request * req )
    738738{
    739     tr_free( req->url );
     739    evbuffer_free( req->url );
    740740    tr_free( req );
    741741}
     
    807807    req->reqtype = reqtype;
    808808    req->done_func =  isStopping ? onStoppedResponse : onTrackerResponse;
    809     req->url = tr_strdup( EVBUFFER_DATA( url ) );
     809    req->url = url;
    810810    req->torrentId = tracker->torrentId;
    811811
    812     evbuffer_free( url );
    813812    return req;
    814813}
     
    829828    req->session = session;
    830829    req->reqtype = TR_REQ_SCRAPE;
    831     req->url = tr_strdup( EVBUFFER_DATA( url ) );
     830    req->url = url;
    832831    req->done_func = onScrapeResponse;
    833832    req->torrentId = tracker->torrentId;
    834833
    835     evbuffer_free( url );
    836834    return req;
    837835}
     
    899897    ++req->session->tracker->runningCount;
    900898
    901     tr_webRun( req->session, req->url, NULL,
     899    tr_webRun( req->session,
     900               (char*)EVBUFFER_DATA(req->url),
     901               NULL,
    902902               req->done_func, tr_int2ptr( req->torrentId ) );
    903903
Note: See TracChangeset for help on using the changeset viewer.