From: Wayne Davison Date: Sat, 22 Sep 2007 16:52:58 +0000 (+0000) Subject: Moved inline functions from rsync.h into ifuncs.h. X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/1b42f628f495ff0cdaa8a7c219d8ce33192281fe Moved inline functions from rsync.h into ifuncs.h. --- diff --git a/clientserver.c b/clientserver.c index d16e5617..43bfdf4a 100644 --- a/clientserver.c +++ b/clientserver.c @@ -20,6 +20,7 @@ */ #include "rsync.h" +#include "ifuncs.h" extern int verbose; extern int quiet; diff --git a/flist.c b/flist.c index dfa81c4d..42518d9a 100644 --- a/flist.c +++ b/flist.c @@ -21,6 +21,7 @@ */ #include "rsync.h" +#include "ifuncs.h" #include "rounding.h" #include "io.h" diff --git a/io.c b/io.c index d89bbf41..e8a07099 100644 --- a/io.c +++ b/io.c @@ -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 diff --git a/loadparm.c b/loadparm.c index 5cd8a8f5..d9c9d931 100644 --- a/loadparm.c +++ b/loadparm.c @@ -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") diff --git a/log.c b/log.c index acb27397..e916b95c 100644 --- a/log.c +++ b/log.c @@ -20,6 +20,7 @@ */ #include "rsync.h" +#include "ifuncs.h" extern int verbose; extern int dry_run; diff --git a/main.c b/main.c index bf3166f4..9f2e2a9f 100644 --- a/main.c +++ b/main.c @@ -21,6 +21,7 @@ */ #include "rsync.h" +#include "ifuncs.h" #include "io.h" #if defined CONFIG_LOCALE && defined HAVE_LOCALE_H #include diff --git a/mkrounding.c b/mkrounding.c index 8550e05f..d978d4bb 100644 --- a/mkrounding.c +++ b/mkrounding.c @@ -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); -} diff --git a/options.c b/options.c index 5ed404dd..d8993c82 100644 --- a/options.c +++ b/options.c @@ -20,6 +20,7 @@ */ #include "rsync.h" +#include "ifuncs.h" #include #include "zlib/zlib.h" diff --git a/params.c b/params.c index 883860e0..30901b6e 100644 --- a/params.c +++ b/params.c @@ -74,6 +74,7 @@ */ #include "rsync.h" +#include "ifuncs.h" /* -------------------------------------------------------------------------- ** * Constants... diff --git a/rsync.c b/rsync.c index a9ba4f29..d22e4dfd 100644 --- a/rsync.c +++ b/rsync.c @@ -20,6 +20,7 @@ */ #include "rsync.h" +#include "ifuncs.h" #if defined HAVE_LIBCHARSET_H && defined HAVE_LOCALE_CHARSET #include #elif defined HAVE_LANGINFO_H && defined HAVE_NL_LANGINFO diff --git a/rsync.h b/rsync.h index c1250b68..16be3be9 100644 --- a/rsync.h +++ b/rsync.h @@ -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); -} diff --git a/socket.c b/socket.c index 51c07f72..ca8c5612 100644 --- a/socket.c +++ b/socket.c @@ -25,6 +25,7 @@ * emulate it using the KAME implementation. */ #include "rsync.h" +#include "ifuncs.h" #include #include #include diff --git a/tls.c b/tls.c index 789651f5..97b713be 100644 --- a/tls.c +++ b/tls.c @@ -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); -} diff --git a/token.c b/token.c index 181e7340..171ab6d3 100644 --- a/token.c +++ b/token.c @@ -20,6 +20,7 @@ */ #include "rsync.h" +#include "ifuncs.h" #include "zlib/zlib.h" extern int do_compression; diff --git a/util.c b/util.c index b309a8da..7a320258 100644 --- a/util.c +++ b/util.c @@ -21,6 +21,7 @@ */ #include "rsync.h" +#include "ifuncs.h" extern int verbose; extern int dry_run; diff --git a/xattrs.c b/xattrs.c index 595ec422..f58908d8 100644 --- a/xattrs.c +++ b/xattrs.c @@ -20,6 +20,7 @@ */ #include "rsync.h" +#include "ifuncs.h" #include "lib/sysxattrs.h" #ifdef SUPPORT_XATTRS