From cee6610ebbfb74ff816f6ef6a05eff00e895cb9c Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Sat, 3 Jan 2009 00:11:31 +0000 Subject: [PATCH] (trunk libT) inline the tr_bencIs*() utility functions --- libtransmission/bencode.c | 6 ------ libtransmission/bencode.h | 12 +++++------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/libtransmission/bencode.c b/libtransmission/bencode.c index 769e08752..c98db9f17 100644 --- a/libtransmission/bencode.c +++ b/libtransmission/bencode.c @@ -34,12 +34,6 @@ *** **/ -tr_bool -tr_bencIsType( const tr_benc * val, int type ) -{ - return ( val ) && ( val->type == type ); -} - static tr_bool isContainer( const tr_benc * val ) { diff --git a/libtransmission/bencode.h b/libtransmission/bencode.h index fe70c9f4c..73695f833 100644 --- a/libtransmission/bencode.h +++ b/libtransmission/bencode.h @@ -156,13 +156,11 @@ tr_bool tr_bencGetInt( const tr_benc * val, int64_t * setme ); tr_bool tr_bencGetStr( const tr_benc * val, const char ** setme ); -tr_bool tr_bencIsType( const tr_benc *, int type ); - - -#define tr_bencIsInt( b ) tr_bencIsType( ( b ), TYPE_INT ) -#define tr_bencIsDict( b ) tr_bencIsType( ( b ), TYPE_DICT ) -#define tr_bencIsList( b ) tr_bencIsType( ( b ), TYPE_LIST ) -#define tr_bencIsString( b ) tr_bencIsType( ( b ), TYPE_STR ) +static inline tr_bool tr_bencIsType ( const tr_benc * b, int type ) { return ( b != NULL ) && ( b->type == type ); } +static inline tr_bool tr_bencIsInt ( const tr_benc * b ) { return tr_bencIsType( b, TYPE_INT ); } +static inline tr_bool tr_bencIsDict ( const tr_benc * b ) { return tr_bencIsType( b, TYPE_DICT ); } +static inline tr_bool tr_bencIsList ( const tr_benc * b ) { return tr_bencIsType( b, TYPE_LIST ); } +static inline tr_bool tr_bencIsString( const tr_benc * b ) { return tr_bencIsType( b, TYPE_STR ); } /** *** Treat these as private -- they're only made public here