Ignore:
Timestamp:
Mar 25, 2011, 5:34:26 AM (11 years ago)
Author:
jordan
Message:

(trunk libT) API cleanup of the tr_address functions to make them more consistent.

This is loosely related to #2910, but only in the sense of laying the groundwork for #2910's fix...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/blocklist.c

    r12228 r12229  
    198198
    199199void
    200 _tr_blocklistSetEnabled( tr_blocklist * b,
    201                          int            isEnabled )
     200_tr_blocklistSetEnabled( tr_blocklist * b, bool isEnabled )
    202201{
    203202    b->isEnabled = isEnabled ? 1 : 0;
     
    205204
    206205int
    207 _tr_blocklistHasAddress( tr_blocklist     * b,
    208                          const tr_address * addr )
     206_tr_blocklistHasAddress( tr_blocklist * b, const tr_address * addr )
    209207{
    210208    uint32_t                     needle;
    211209    const struct tr_ipv4_range * range;
    212210
    213     assert( tr_isAddress( addr ) );
     211    assert( tr_address_is_valid( addr ) );
    214212
    215213    if( !b->isEnabled || addr->type == TR_AF_INET6 )
     
    257255
    258256    tr_snprintf( str, sizeof( str ), "%d.%d.%d.%d", b[0], b[1], b[2], b[3] );
    259     if( tr_pton( str, &addr ) == NULL )
     257    if( !tr_address_from_string( &addr, str ) )
    260258        return false;
    261259    range->begin = ntohl( addr.addr.addr4.s_addr );
    262260
    263261    tr_snprintf( str, sizeof( str ), "%d.%d.%d.%d", e[0], e[1], e[2], e[3] );
    264     if( tr_pton( str, &addr ) == NULL )
     262    if( !tr_address_from_string( &addr, str ) )
    265263        return false;
    266264    range->end = ntohl( addr.addr.addr4.s_addr );
     
    289287
    290288    tr_snprintf( str, sizeof(str), "%d.%d.%d.%d", a[0], a[1], a[2], a[3] );
    291     if( tr_pton( str, &addr ) == NULL )
     289    if( !tr_address_from_string( &addr, str ) )
    292290        return false;
    293291    range->begin = ntohl( addr.addr.addr4.s_addr );
    294292
    295293    tr_snprintf( str, sizeof(str), "%d.%d.%d.%d", b[0], b[1], b[2], b[3] );
    296     if( tr_pton( str, &addr ) == NULL )
     294    if( !tr_address_from_string( &addr, str ) )
    297295        return false;
    298296    range->end = ntohl( addr.addr.addr4.s_addr );
Note: See TracChangeset for help on using the changeset viewer.