Changeset 13300


Ignore:
Timestamp:
May 17, 2012, 5:40:31 PM (9 years ago)
Author:
jordan
Message:

(trunk libT) #4894 -- don't use evbuffer_add_printf() and evbuffer_pullup() together.

Location:
trunk/libtransmission
Files:
4 edited

Legend:

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

    r13191 r13300  
    5151}
    5252
    53 static struct evbuffer *
     53static char*
    5454announce_url_new( const tr_session * session, const tr_announce_request * req )
    5555{
     
    117117    }
    118118
    119     return buf;
     119    return evbuffer_free_to_str( buf );
    120120}
    121121
     
    288288{
    289289    struct announce_data * d;
    290     struct evbuffer * buf = announce_url_new( session, request );
    291     const char * url = (const char *) evbuffer_pullup( buf, -1 );
     290    char * url = announce_url_new( session, request );
    292291
    293292    d = tr_new0( struct announce_data, 1 );
     
    303302    tr_webRun( session, url, NULL, NULL, on_announce_done, d );
    304303
    305     evbuffer_free( buf );
     304    tr_free( url );
    306305}
    307306
     
    430429}
    431430
    432 static struct evbuffer *
     431static char *
    433432scrape_url_new( const tr_scrape_request * req )
    434433{
     
    447446    }
    448447
    449     return buf;
     448    return evbuffer_free_to_str( buf );
    450449}
    451450
     
    458457    int i;
    459458    struct scrape_data * d;
    460     struct evbuffer * buf = scrape_url_new( request );
    461     const char * url = (const char *) evbuffer_pullup( buf, -1 );
     459    char * url = scrape_url_new( request );
    462460
    463461    d = tr_new0( struct scrape_data, 1 );
     
    478476    tr_webRun( session, url, NULL, NULL, on_scrape_done, d );
    479477
    480     evbuffer_free( buf );
    481 }
     478    tr_free( url );
     479}
  • trunk/libtransmission/announcer.c

    r13155 r13300  
    754754        int i;
    755755        char name[128];
     756        char * message;
    756757        struct evbuffer * buf = evbuffer_new( );
    757758
     
    764765        }
    765766
    766         tr_deepLog( __FILE__, __LINE__, name, "announce queue is %s", evbuffer_pullup( buf, -1 ) );
    767         evbuffer_free( buf );
     767        message = evbuffer_free_to_str( buf );
     768        tr_deepLog( __FILE__, __LINE__, name, "announce queue is %s", message );
     769        tr_free( message );
    768770    }
    769771}
  • trunk/libtransmission/peer-msgs.c

    r13154 r13300  
    240240        struct evbuffer * buf = evbuffer_new( );
    241241        char *            base = tr_basename( file );
     242        char *            message;
    242243
    243244        evbuffer_add_printf( buf, "[%s] %s - %s [%s]: ",
     
    250251        va_end( args );
    251252        evbuffer_add_printf( buf, " (%s:%d)\n", base, line );
    252         fputs( (const char*)evbuffer_pullup( buf, -1 ), fp );
     253
     254        message = evbuffer_free_to_str( buf );
     255        fputs( message, fp );
    253256
    254257        tr_free( base );
    255         evbuffer_free( buf );
     258        tr_free( message );
    256259    }
    257260}
  • trunk/libtransmission/utils.c

    r13191 r13300  
    232232        struct evbuffer * buf = evbuffer_new( );
    233233        char *            base = tr_basename( file );
     234        char *            message;
     235        const char      * str;
    234236
    235237        evbuffer_add_printf( buf, "[%s] ",
     
    242244        evbuffer_add_printf( buf, " (%s:%d)\n", base, line );
    243245        /* FIXME(libevent2) ifdef this out for nonwindows platforms */
    244         OutputDebugString( evbuffer_pullup( buf, -1 ) );
     246        message = evbuffer_free_to_str( buf );
     247        OutputDebugString( message );
    245248        if( fp )
    246             fputs( (const char*)evbuffer_pullup( buf, -1 ), fp );
    247 
     249            fputs( message, fp );
     250
     251        tr_free( message );
    248252        tr_free( base );
    249         evbuffer_free( buf );
    250253    }
    251254}
Note: See TracChangeset for help on using the changeset viewer.