Moved inline functions from rsync.h into ifuncs.h.

This commit is contained in:
Wayne Davison
2007-09-22 16:52:58 +00:00
parent 5dafe360de
commit 1b42f628f4
16 changed files with 19 additions and 116 deletions

View File

@@ -20,6 +20,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
extern int verbose;
extern int quiet;

View File

@@ -21,6 +21,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
#include "rounding.h"
#include "io.h"

1
io.c
View File

@@ -28,6 +28,7 @@
* io_start_multiplex_out() and io_start_multiplex_in(). */
#include "rsync.h"
#include "ifuncs.h"
/** If no timeout is specified then use a 60 second select timeout */
#define SELECT_TIMEOUT 60

View File

@@ -50,6 +50,7 @@
/* TODO: Parameter to set debug level on server. */
#include "rsync.h"
#include "ifuncs.h"
#define PTR_DIFF(p1,p2) ((ptrdiff_t)(((char *)(p1)) - (char *)(p2)))
#define strequal(a,b) (strcasecmp(a,b)==0)
#define BOOLSTR(b) ((b) ? "Yes" : "No")

1
log.c
View File

@@ -20,6 +20,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
extern int verbose;
extern int dry_run;

1
main.c
View File

@@ -21,6 +21,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
#include "io.h"
#if defined CONFIG_LOCALE && defined HAVE_LOCALE_H
#include <locale.h>

View File

@@ -64,19 +64,3 @@ struct test4 {
printf("#define EXTRA_ROUNDING %d\n", cnt);
return 0;
}
void *_new_array(UNUSED(unsigned long num), UNUSED(unsigned int size), UNUSED(int use_calloc))
{
out_of_memory("");
}
void *_realloc_array(UNUSED(void *ptr), UNUSED(unsigned int size), UNUSED(unsigned long num))
{
out_of_memory("");
}
NORETURN void out_of_memory(UNUSED(const char *str))
{
fprintf(stderr, "ERROR: this function should not be called!\n");
exit(1);
}

View File

@@ -20,6 +20,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
#include <popt.h>
#include "zlib/zlib.h"

View File

@@ -74,6 +74,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
/* -------------------------------------------------------------------------- **
* Constants...

View File

@@ -20,6 +20,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
#if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET
#include <libcharset.h>
#elif defined HAVE_LANGINFO_H && defined HAVE_NL_LANGINFO

83
rsync.h
View File

@@ -1069,86 +1069,3 @@ int inet_pton(int af, const char *src, void *dst);
#ifdef MAINTAINER_MODE
const char *get_panic_action(void);
#endif
static inline void
alloc_xbuf(xbuf *xb, size_t sz)
{
if (!(xb->buf = new_array(char, sz)))
out_of_memory("alloc_xbuf");
xb->size = sz;
xb->len = xb->pos = 0;
}
static inline void
realloc_xbuf(xbuf *xb, size_t sz)
{
char *bf = realloc_array(xb->buf, char, sz);
if (!bf)
out_of_memory("realloc_xbuf");
xb->buf = bf;
xb->size = sz;
}
static inline int
to_wire_mode(mode_t mode)
{
#ifdef SUPPORT_LINKS
#if _S_IFLNK != 0120000
if (S_ISLNK(mode))
return (mode & ~(_S_IFMT)) | 0120000;
#endif
#endif
return mode;
}
static inline mode_t
from_wire_mode(int mode)
{
#if _S_IFLNK != 0120000
if ((mode & (_S_IFMT)) == 0120000)
return (mode & ~(_S_IFMT)) | _S_IFLNK;
#endif
return mode;
}
static inline int
isDigit(const char *ptr)
{
return isdigit(*(unsigned char *)ptr);
}
static inline int
isPrint(const char *ptr)
{
return isprint(*(unsigned char *)ptr);
}
static inline int
isSpace(const char *ptr)
{
return isspace(*(unsigned char *)ptr);
}
static inline int
isLower(const char *ptr)
{
return islower(*(unsigned char *)ptr);
}
static inline int
isUpper(const char *ptr)
{
return isupper(*(unsigned char *)ptr);
}
static inline int
toLower(const char *ptr)
{
return tolower(*(unsigned char *)ptr);
}
static inline int
toUpper(const char *ptr)
{
return toupper(*(unsigned char *)ptr);
}

View File

@@ -25,6 +25,7 @@
* emulate it using the KAME implementation. */
#include "rsync.h"
#include "ifuncs.h"
#include <netinet/in_systm.h>
#include <netinet/ip.h>
#include <netinet/tcp.h>

23
tls.c
View File

@@ -89,7 +89,12 @@ static int stat_xattr(const char *fname, STRUCT_STAT *fst)
exit(1);
}
fst->st_mode = from_wire_mode(mode);
#if _S_IFLNK != 0120000
if ((mode & (_S_IFMT)) == 0120000)
mode = (mode & ~(_S_IFMT)) | _S_IFLNK;
#endif
fst->st_mode = mode;
fst->st_rdev = MAKEDEV(rdev_major, rdev_minor);
fst->st_uid = uid;
fst->st_gid = gid;
@@ -230,19 +235,3 @@ main(int argc, char *argv[])
return 0;
}
void *_new_array(UNUSED(unsigned long num), UNUSED(unsigned int size), UNUSED(int use_calloc))
{
out_of_memory("");
}
void *_realloc_array(UNUSED(void *ptr), UNUSED(unsigned int size), UNUSED(unsigned long num))
{
out_of_memory("");
}
NORETURN void out_of_memory(UNUSED(const char *str))
{
fprintf(stderr, "ERROR: this function should not be called!\n");
exit(1);
}

View File

@@ -20,6 +20,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
#include "zlib/zlib.h"
extern int do_compression;

1
util.c
View File

@@ -21,6 +21,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
extern int verbose;
extern int dry_run;

View File

@@ -20,6 +20,7 @@
*/
#include "rsync.h"
#include "ifuncs.h"
#include "lib/sysxattrs.h"
#ifdef SUPPORT_XATTRS