reverse patch #6948. one of the new gcc attributes seems to be causing trouble.

This commit is contained in:
Charles Kerr 2008-10-23 02:37:21 +00:00
parent f0eddb5c20
commit 188adb1d6a
10 changed files with 92 additions and 86 deletions

View File

@ -21,6 +21,8 @@
#include "lock.h"
#include "logo.h"
#define UNUSED G_GNUC_UNUSED
static TrCore * myCore = NULL;
static GtkActionGroup * myGroup = NULL;

View File

@ -88,7 +88,6 @@ noinst_HEADERS = \
torrent.h \
tracker.h \
tr-getopt.h \
tr-gnuc.h \
transmission.h \
trevent.h \
upnp.h \

View File

@ -13,31 +13,32 @@
#ifndef TR_BLOCKLIST_H
#define TR_BLOCKLIST_H
#include "tr-gnuc.h"
struct in_addr;
typedef struct tr_blocklist tr_blocklist;
tr_blocklist* _tr_blocklistNew( const char * filename,
int isEnabled ) TR_GNUC_MALLOC;
int isEnabled );
int _tr_blocklistExists ( const tr_blocklist * blocklist );
int _tr_blocklistExists( const tr_blocklist * );
const char* _tr_blocklistGetFilename ( const tr_blocklist * blocklist );
const char* _tr_blocklistGetFilename( const tr_blocklist * );
int _tr_blocklistGetRuleCount( const tr_blocklist * blocklist );
int _tr_blocklistGetRuleCount( const tr_blocklist * );
void _tr_blocklistFree ( tr_blocklist * blocklist );
void _tr_blocklistFree( tr_blocklist * );
int _tr_blocklistIsEnabled ( tr_blocklist * blocklist );
int _tr_blocklistIsEnabled( tr_blocklist * );
void _tr_blocklistSetEnabled ( tr_blocklist * blocklist,
int isEnabled );
void _tr_blocklistSetEnabled( tr_blocklist *,
int isEnabled );
int _tr_blocklistHasAddress ( tr_blocklist * blocklist,
const struct in_addr * addr );
int _tr_blocklistHasAddress(
tr_blocklist *,
const struct
in_addr * addr );
int _tr_blocklistSetContent ( tr_blocklist * blocklist,
const char * filename );
int _tr_blocklistSetContent(
tr_blocklist *,
const char * filename );
#endif

View File

@ -29,12 +29,12 @@ typedef int ( *handshakeDoneCB )( struct tr_handshake * handshake,
tr_handshake * tr_handshakeNew( struct tr_peerIo * io,
tr_encryption_mode encryptionMode,
handshakeDoneCB doneCB,
void * doneUserData )
TR_GNUC_MALLOC;
void * doneUserData );
const struct in_addr * tr_handshakeGetAddr(
const struct tr_handshake * handshake,
uint16_t * setme_port );
const struct tr_handshake * handshake,
uint16_t
* setme_port );
void tr_handshakeAbort( tr_handshake * handshake );

View File

@ -17,8 +17,6 @@
***
**/
#include "tr-gnuc.h"
struct in_addr;
struct evbuffer;
struct bufferevent;
@ -30,17 +28,17 @@ typedef struct tr_peerIo tr_peerIo;
***
**/
tr_peerIo* tr_peerIoNewOutgoing( struct tr_handle * session,
const struct in_addr * addr,
int port,
const uint8_t * torrentHash )
TR_GNUC_MALLOC;
tr_peerIo* tr_peerIoNewOutgoing(
struct tr_handle * session,
const struct in_addr * addr,
int port,
const uint8_t *
torrentHash );
tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session,
const struct in_addr * addr,
uint16_t port,
int socket )
TR_GNUC_MALLOC;
tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session,
const struct in_addr * addr,
uint16_t port,
int socket );
void tr_peerIoFree( tr_peerIo * io );
@ -70,13 +68,13 @@ const char* tr_peerIoAddrStr( const struct in_addr * addr,
const char* tr_peerIoGetAddrStr( const tr_peerIo * io );
const struct in_addr*tr_peerIoGetAddress( const tr_peerIo * io,
uint16_t * port );
uint16_t * port );
const uint8_t* tr_peerIoGetTorrentHash( tr_peerIo * io );
int tr_peerIoHasTorrentHash( const tr_peerIo * io );
void tr_peerIoSetTorrentHash( tr_peerIo * io,
void tr_peerIoSetTorrentHash( tr_peerIo * io,
const uint8_t * hash );
int tr_peerIoReconnect( tr_peerIo * io );
@ -123,6 +121,11 @@ void tr_peerIoSetIOFuncs( tr_peerIo * io,
int tr_peerIoWantsBandwidth( const tr_peerIo * io,
tr_direction );
#if 0
void tr_peerIoTryRead( tr_peerIo * io );
#endif
void tr_peerIoWrite( tr_peerIo * io,
const void * writeme,
size_t writemeLen );

View File

@ -15,8 +15,11 @@
#include <inttypes.h> /* uint16_t */
#include "net.h" /* struct in_addr */
#include "tr-gnuc.h"
#ifdef WIN32
#include <winsock2.h> /* struct in_addr */
#else
#include <netinet/in.h> /* struct in_addr */
#endif
struct in_addr;
struct tr_handle;
@ -43,7 +46,7 @@ tr_pex;
int tr_pexCompare( const void * a, const void * b );
tr_peerMgr* tr_peerMgrNew( struct tr_handle * ) TR_GNUC_MALLOC;
tr_peerMgr* tr_peerMgrNew( struct tr_handle * );
void tr_peerMgrFree( tr_peerMgr * manager );

View File

@ -27,7 +27,13 @@
#define TR_NAME "Transmission"
#include "tr-gnuc.h"
#ifndef UNUSED
#ifdef __GNUC__
#define UNUSED __attribute__ ( ( unused ) )
#else
#define UNUSED
#endif
#endif
enum
{
@ -41,7 +47,7 @@ enum
typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
uint8_t* tr_peerIdNew( void ) TR_GNUC_MALLOC;
uint8_t* tr_peerIdNew( void );
const uint8_t* tr_getPeerId( void );

View File

@ -1,40 +0,0 @@
#ifndef TR_GNUC_H
#define TR_GNUC_H 1
#ifndef UNUSED
#ifdef __GNUC__
#define UNUSED __attribute__ ( ( unused ) )
#else
#define UNUSED
#endif
#endif
#ifndef TR_GNUC_PRINTF
#ifdef __GNUC__
#define TR_GNUC_PRINTF( fmt,\
args ) __attribute__ ( ( format ( printf, fmt,\
args ) ) )
#else
#define TR_GNUC_PRINTF( fmt, args )
#endif
#endif
#ifndef TR_GNUC_NULL_TERMINATED
#if __GNUC__ >= 4
#define TR_GNUC_NULL_TERMINATED __attribute__ ( ( __sentinel__ ) )
#else
#define TR_GNUC_NULL_TERMINATED
#endif
#endif
#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 )
#define TR_GNUC_CONST __attribute__ ( ( __const ) )
#define TR_GNUC_PURE __attribute__ ( ( __pure__ ) )
#define TR_GNUC_MALLOC __attribute__ ( ( __malloc__ ) )
#else
#define TR_GNUC_CONST
#define TR_GNUC_PURE
#define TR_GNUC_MALLOC
#endif
#endif

View File

@ -36,7 +36,6 @@
extern "C" {
#endif
#include "tr-gnuc.h"
#include "version.h"
#include <inttypes.h> /* uintN_t */
@ -728,7 +727,7 @@ tr_ctorMode;
struct tr_benc;
tr_ctor* tr_ctorNew( const tr_handle * handle ) TR_GNUC_MALLOC;
tr_ctor* tr_ctorNew( const tr_handle * handle );
void tr_ctorFree( tr_ctor * ctor );
@ -810,7 +809,7 @@ int tr_torrentParse( const tr_handle * handle,
TR_EDUPLICATE if there's already a matching torrent object. */
tr_torrent * tr_torrentNew( tr_handle * handle,
const tr_ctor * ctor,
int * setmeError ) TR_GNUC_MALLOC;
int * setmeError );
/** @} */

View File

@ -47,7 +47,40 @@ extern "C" {
#define TRUE 1
#endif
#include "tr-gnuc.h"
#ifndef UNUSED
#ifdef __GNUC__
#define UNUSED __attribute__ ( ( unused ) )
#else
#define UNUSED
#endif
#endif
#ifndef TR_GNUC_PRINTF
#ifdef __GNUC__
#define TR_GNUC_PRINTF( fmt,\
args ) __attribute__ ( ( format ( printf, fmt,\
args ) ) )
#else
#define TR_GNUC_PRINTF( fmt, args )
#endif
#endif
#ifndef TR_GNUC_NULL_TERMINATED
#if __GNUC__ >= 4
#define TR_GNUC_NULL_TERMINATED __attribute__ ( ( __sentinel__ ) )
#else
#define TR_GNUC_NULL_TERMINATED
#endif
#endif
#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 )
#define TR_GNUC_PURE __attribute__ ( ( __pure__ ) )
#define TR_GNUC_MALLOC __attribute__ ( ( __malloc__ ) )
#else
#define TR_GNUC_PURE
#define TR_GNUC_MALLOC
#endif
/***
****
@ -159,10 +192,10 @@ void tr_timevalMsec( uint64_t milliseconds,
/* return the current date in milliseconds */
uint64_t tr_date( void ) TR_GNUC_CONST;
uint64_t tr_date( void );
/* wait the specified number of milliseconds */
void tr_wait( uint64_t delay_milliseconds ) TR_GNUC_CONST;
void tr_wait( uint64_t delay_milliseconds );
/***
****
@ -229,7 +262,7 @@ int tr_snprintf( char * buf,
const char * fmt,
... ) TR_GNUC_PRINTF( 3, 4 );
const char* tr_strerror( int ) TR_GNUC_CONST;
const char* tr_strerror( int );
char* tr_strstrip( char * str );
@ -326,7 +359,7 @@ tr_bitfield* tr_bitfieldOr( tr_bitfield*,
&& tr_bitfieldHasFast( bitfield, nth ) )
double tr_getRatio( double numerator,
double denominator ) TR_GNUC_CONST;
double denominator );
#ifdef __cplusplus
}