Changeset 10507


Ignore:
Timestamp:
Apr 21, 2010, 7:23:27 PM (11 years ago)
Author:
charles
Message:

(trunk gtk) add gtr_warn_if_fail(), a portability wrapper for systems too old for g_warn_if_fail()

Location:
trunk/gtk
Files:
2 edited

Legend:

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

    r10505 r10507  
    12141214        /* remove the torrent */
    12151215        tr_torrent_set_remove_flag( gtor, TRUE );
    1216         g_warn_if_fail( G_OBJECT( gtor )->ref_count == 1 );
     1216        gtr_warn_if_fail( G_OBJECT( gtor )->ref_count == 1 );
    12171217        g_object_unref( G_OBJECT( gtor ) ); /* remove the last refcount */
    12181218    }
  • trunk/gtk/util.h

    r10505 r10507  
    1515
    1616#include <sys/types.h>
     17#include <glib.h>
    1718#include <gtk/gtk.h>
     19
     20/* portability wrapper around g_warn_if_fail() for older versions of glib */
     21#ifdef g_warn_if_fail
     22 #define gtr_warn_if_fail(expr) g_warn_if_fail(expr)
     23#else
     24 #define gtr_warn_if_fail(expr) do { if G_LIKELY (expr) ; else \
     25                                       g_log (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, "%s:%d func(): %s: invariant failed: %s", \
     26                                              __FILE__, __LINE__, G_STRFUNC, #expr ); } while(0)
     27#endif
    1828
    1929/* macro to shut up "unused parameter" warnings */
Note: See TracChangeset for help on using the changeset viewer.