Changeset 11088


Ignore:
Timestamp:
Aug 1, 2010, 7:13:34 PM (12 years ago)
Author:
charles
Message:

(trunk gtk) replace tr_strcmp() with gtr_strcmp0(), a porability wrapper around g_strcmp0()

Location:
trunk/gtk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/tr-core.c

    r11087 r11088  
    543543}
    544544
    545 static int
    546 tr_strcmp( const void * a,
    547            const void * b )
    548 {
    549     if( a && b ) return strcmp( a, b );
    550     if( a ) return 1;
    551     if( b ) return -1;
    552     return 0;
    553 }
    554 
    555545static char *
    556546torrentTrackerString( tr_torrent * tor )
     
    719709    struct TrCorePrivate * p = TR_CORE( core )->priv;
    720710
    721     if( p->monitor && ( !isEnabled || tr_strcmp( filename, p->monitor_path ) ) )
     711    if( p->monitor && ( !isEnabled || gtr_strcmp0( filename, p->monitor_path ) ) )
    722712    {
    723713        g_signal_handler_disconnect( p->monitor, p->monitor_tag );
     
    13401330        || ( newFinished != oldFinished )
    13411331        || ( newPriority != oldPriority )
    1342         || tr_strcmp( oldTrackers, newTrackers )
     1332        || gtr_strcmp0( oldTrackers, newTrackers )
    13431333        || gtr_compare_double( newUpSpeed, oldUpSpeed, 3 )
    13441334        || gtr_compare_double( newDownSpeed, oldDownSpeed, 3 ) )
     
    15351525    const char * oldval = pref_string_get( key );
    15361526
    1537     if( tr_strcmp( oldval, newval ) )
     1527    if( gtr_strcmp0( oldval, newval ) )
    15381528    {
    15391529        pref_string_set( key, newval );
  • trunk/gtk/util.c

    r11087 r11088  
    479479#endif
    480480    return object;
     481}
     482
     483int
     484gtr_strcmp0( const char * str1, const char * str2 )
     485{
     486#if GLIB_CHECK_VERSION( 2, 16, 0 )
     487    return g_strcmp0( str1, str2 );
     488#else
     489    if( str1 && str2 ) return strcmp( str1, str2 );
     490    if( str1 ) return 1;
     491    if( str2 ) return -1;
     492    return 0;
     493#endif
    481494}
    482495
  • trunk/gtk/util.h

    r11045 r11088  
    159159gpointer gtr_object_ref_sink( gpointer object );
    160160
     161/* backwards-comparible wrapper around g_strcmp0() */
     162int gtr_strcmp0( const char * str1, const char * str2 );
     163
    161164/***
    162165****
Note: See TracChangeset for help on using the changeset viewer.