clean up #includes a bit.

This commit is contained in:
Charles Kerr 2007-07-12 17:51:45 +00:00
parent 481dc9f6b8
commit 790476ac23
17 changed files with 62 additions and 40 deletions

View File

@ -22,7 +22,8 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <ctype.h> /* for isdigit */
#include <ctype.h> /* isdigit, isprint */
#include <stdarg.h>
#include "transmission.h"
#include "bencode.h"

View File

@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <ctype.h> /* isprint */
#include "transmission.h"
static int charToInt( char character );

View File

@ -41,6 +41,9 @@
* so the resume file will not be read).
**********************************************************************/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "transmission.h"
#include "fastresume.h"

View File

@ -22,6 +22,8 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <fcntl.h>
#include <unistd.h>
#include "transmission.h"
#define TR_MAX_OPEN_FILES 16 /* That is, real files, not sockets */

View File

@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <stdarg.h>
#include "transmission.h"
#include "http.h"
#include "net.h"

View File

@ -8,6 +8,9 @@
* the Transmission project.
*/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include "transmission.h"
#include "fastresume.h"
#include "fdlimit.h"

View File

@ -32,7 +32,6 @@
#include <sys/param.h>
#endif
#include <stdio.h>
#include <stdarg.h>
#ifdef SYS_BEOS
/* BeOS doesn't declare vasprintf in its headers, but actually
* implements it */
@ -40,22 +39,11 @@ int vasprintf( char **, const char *, va_list );
#endif
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#ifndef __AMIGAOS4__
#include <sys/resource.h>
#endif
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include <assert.h>
#ifdef SYS_BEOS
# define socklen_t uint32_t

View File

@ -24,6 +24,7 @@
#include <assert.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -22,9 +22,12 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h> /* unlink, stat */
#include "transmission.h"
#include "bencode.h"
#include "http.h" /* for tr_httpParseUrl */
#include "http.h" /* tr_httpParseUrl */
#include "metainfo.h"
#define TORRENT_MAX_SIZE (5*1024*1024)

View File

@ -22,6 +22,10 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <fcntl.h>
#include "transmission.h"
#include "fdlimit.h"
#include "net.h"

View File

@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <stdarg.h>
#include "transmission.h"
#include "bencode.h"
#include "clients.h" /* for tr_clientForId() */

View File

@ -28,7 +28,8 @@
#endif
#include <sys/types.h>
#include <dirent.h>
#include <fcntl.h>
#include <unistd.h> /* getuid getpid close */
#include "transmission.h"
#if !defined( SYS_BEOS ) && !defined( __AMIGAOS4__ )

View File

@ -22,6 +22,9 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#ifndef _TR_RATECONTROL_H_
#define _TR_RATECONTROL_H_
typedef struct tr_ratecontrol_s tr_ratecontrol_t;
tr_ratecontrol_t * tr_rcInit( void );
@ -31,3 +34,5 @@ void tr_rcTransferred( tr_ratecontrol_t *, int );
float tr_rcRate( const tr_ratecontrol_t * );
void tr_rcReset( tr_ratecontrol_t * );
void tr_rcClose( tr_ratecontrol_t * );
#endif

View File

@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <signal.h>
#include "transmission.h"
#include "fdlimit.h"
#include "net.h"

View File

@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <stdarg.h>
#include "transmission.h"
#include "http.h"
#include "net.h"

View File

@ -23,6 +23,11 @@
*****************************************************************************/
#include <ctype.h>
#include <stdarg.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h> /* usleep, stat */
#include "transmission.h"
#define SPRINTF_BUFSIZE 100
@ -593,3 +598,25 @@ tr_bitfieldCountTrueBits( const tr_bitfield_t* b )
return ret;
}
/***
****
***/
uint64_t
tr_date( void )
{
struct timeval tv;
gettimeofday( &tv, NULL );
return (uint64_t) tv.tv_sec * 1000 + ( tv.tv_usec / 1000 );
}
void
tr_wait( uint64_t delay_msec )
{
#ifdef SYS_BEOS
snooze( 1000 * delay_msec );
#else
usleep( 1000 * delay_msec );
#endif
}

View File

@ -76,32 +76,11 @@ int tr_ioErrorFromErrno( void );
char * tr_errorString( int code );
/***********************************************************************
* tr_date
***********************************************************************
* Returns the current date in milliseconds
**********************************************************************/
static inline uint64_t tr_date()
{
struct timeval tv;
gettimeofday( &tv, NULL );
return (uint64_t) tv.tv_sec * 1000 + ( tv.tv_usec / 1000 );
}
/***********************************************************************
* tr_wait
***********************************************************************
* Wait 'delay' milliseconds
**********************************************************************/
static inline void tr_wait( uint64_t delay )
{
#ifdef SYS_BEOS
snooze( 1000 * delay );
#else
usleep( 1000 * delay );
#endif
}
/* return the current date in milliseconds */
uint64_t tr_date( void );
/* wait the specified number of milliseconds */
void tr_wait( uint64_t delay_milliseconds );
#define tr_blockPiece(a) _tr_blockPiece(tor,a)
static inline int _tr_blockPiece( const tr_torrent_t * tor, int block )