Changeset 5337


Ignore:
Timestamp:
Mar 23, 2008, 3:15:05 AM (14 years ago)
Author:
charles
Message:

#809: reduce memory overhead in tr_info structure

Location:
trunk/libtransmission
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r5329 r5337  
    194194
    195195    tr_sha1_to_hex( inf->hashString, inf->hash );
    196     savedname( inf->torrent, sizeof( inf->torrent ), inf->hashString, tag );
     196    savedname( buf, sizeof( buf ), inf->hashString, tag );
     197    tr_free( inf->torrent );
     198    inf->torrent = tr_strdup( buf );
    197199
    198200    /* comment */
     
    315317    tr_free( inf->comment );
    316318    tr_free( inf->creator );
     319    tr_free( inf->torrent );
     320    tr_free( inf->name );
    317321    tr_free( inf->primaryAddress );
    318322   
     
    643647    }
    644648
    645     strlcat_utf8( inf->name, name->val.s.s, sizeof( inf->name ),
    646                   TR_PATH_DELIMITER );
    647     if( '\0' == inf->name[0] )
     649    tr_free( inf->name );
     650    inf->name = tr_strdup( name->val.s.s );
     651    if( !inf->name || !*inf->name )
    648652    {
    649653        tr_err( _( "Invalid metadata entry \"%s\"" ), "name" );
  • trunk/libtransmission/transmission.h

    r5329 r5337  
    664664{
    665665    /* Path to torrent */
    666     char                 torrent[MAX_PATH_LENGTH];
     666    char               * torrent;
    667667
    668668    /* General info */
    669669    uint8_t              hash[SHA_DIGEST_LENGTH];
    670670    char                 hashString[2*SHA_DIGEST_LENGTH+1];
    671     char                 name[MAX_PATH_LENGTH];
     671    char               * name;
    672672
    673673    /* Flags */
Note: See TracChangeset for help on using the changeset viewer.