Ignore:
Timestamp:
Dec 30, 2008, 8:32:00 PM (13 years ago)
Author:
charles
Message:

(trunk libT) have a pool of reusable evbuffers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/rpc-server.c

    r7479 r7549  
    7777{
    7878    const char *      code_text = tr_webGetResponseStr( code );
    79     struct evbuffer * body = evbuffer_new( );
     79    struct evbuffer * body = tr_getBuffer( );
    8080
    8181    evbuffer_add_printf( body, "<h1>%d: %s</h1>", code, code_text );
     
    8383        evbuffer_add_printf( body, "%s", text );
    8484    evhttp_send_reply( req, code, code_text, body );
    85     evbuffer_free( body );
     85
     86    tr_releaseBuffer( body );
    8687}
    8788
     
    320321
    321322            errno = error;
    322             out = evbuffer_new( );
     323            out = tr_getBuffer( );
    323324            evhttp_add_header( req->output_headers, "Content-Type",
    324325                               mimetype_guess( filename ) );
     
    326327            evhttp_send_reply( req, HTTP_OK, "OK", out );
    327328
    328             evbuffer_free( out );
     329            tr_releaseBuffer( out );
    329330            tr_free( content );
    330331        }
     
    399400    }
    400401
    401     buf = evbuffer_new( );
     402    buf = tr_getBuffer( );
    402403    add_response( req, buf, out, len );
    403404    evhttp_add_header( req->output_headers, "Content-Type",
     
    406407
    407408    /* cleanup */
    408     evbuffer_free( buf );
     409    tr_releaseBuffer( buf );
    409410    tr_free( out );
    410411}
Note: See TracChangeset for help on using the changeset viewer.