Ignore:
Timestamp:
Apr 27, 2011, 8:41:47 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) heap pruning: avoid unnecessary malloc+memcpy+frees in announcer.

  1. when creating announce URLs in announcer-http.c
  2. when creating scrape URLs in announcer-http.c
  3. when deep-logging what announces are in a torrent's queue in announcer.c
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer-http.c

    r12238 r12388  
    5151}
    5252
    53 static char*
     53static struct evbuffer *
    5454announce_url_new( const tr_session * session, const tr_announce_request * req )
    5555{
     
    117117    }
    118118
    119     return evbuffer_free_to_str( buf );
     119    return buf;
    120120}
    121121
     
    280280{
    281281    struct announce_data * d;
    282     char * url = announce_url_new( session, request );
     282    struct evbuffer * buf = announce_url_new( session, request );
     283    const char * url = (const char *) evbuffer_pullup( buf, -1 );
    283284
    284285    d = tr_new0( struct announce_data, 1 );
     
    290291    dbgmsg( request->log_name, "Sending announce to libcurl: \"%s\"", url );
    291292    tr_webRun( session, url, NULL, NULL, on_announce_done, d );
    292     tr_free( url );
     293
     294    evbuffer_free( buf );
    293295}
    294296
     
    399401}
    400402
    401 static char*
     403static struct evbuffer *
    402404scrape_url_new( const tr_scrape_request * req )
    403405{
     
    416418    }
    417419
    418     return evbuffer_free_to_str( buf );
     420    return buf;
    419421}
    420422
     
    427429    int i;
    428430    struct scrape_data * d;
    429     char * url = scrape_url_new( request );
     431    struct evbuffer * buf = scrape_url_new( request );
     432    const char * url = (const char *) evbuffer_pullup( buf, -1 );
    430433
    431434    d = tr_new0( struct scrape_data, 1 );
     
    440443    dbgmsg( request->log_name, "Sending scrape to libcurl: \"%s\"", url );
    441444    tr_webRun( session, url, NULL, NULL, on_scrape_done, d );
    442     tr_free( url );
    443 }
     445
     446    evbuffer_free( buf );
     447}
Note: See TracChangeset for help on using the changeset viewer.