Moved inline functions from rsync.h into ifuncs.h.
authorWayne Davison <wayned@samba.org>
Sat, 22 Sep 2007 16:52:58 +0000 (16:52 +0000)
committerWayne Davison <wayned@samba.org>
Sat, 22 Sep 2007 16:52:58 +0000 (16:52 +0000)
16 files changed:
clientserver.c
flist.c
io.c
loadparm.c
log.c
main.c
mkrounding.c
options.c
params.c
rsync.c
rsync.h
socket.c
tls.c
token.c
util.c
xattrs.c

index d16e561..43bfdf4 100644 (file)
@@ -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 dfa81c4..42518d9 100644 (file)
--- 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 d89bbf4..e8a0709 100644 (file)
--- 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
index 5cd8a8f..d9c9d93 100644 (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")
diff --git a/log.c b/log.c
index acb2739..e916b95 100644 (file)
--- 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 bf3166f..9f2e2a9 100644 (file)
--- 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 <locale.h>
index 8550e05..d978d4b 100644 (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);
-}
index 5ed404d..d8993c8 100644 (file)
--- a/options.c
+++ b/options.c
@@ -20,6 +20,7 @@
  */
 
 #include "rsync.h"
+#include "ifuncs.h"
 #include <popt.h>
 #include "zlib/zlib.h"
 
index 883860e..30901b6 100644 (file)
--- 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 a9ba4f2..d22e4df 100644 (file)
--- 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 <libcharset.h>
 #elif defined HAVE_LANGINFO_H && defined HAVE_NL_LANGINFO
diff --git a/rsync.h b/rsync.h
index c1250b6..16be3be 100644 (file)
--- 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);
-}
index 51c07f7..ca8c561 100644 (file)
--- a/socket.c
+++ b/socket.c
@@ -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>
diff --git a/tls.c b/tls.c
index 789651f..97b713b 100644 (file)
--- 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 181e734..171ab6d 100644 (file)
--- 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 b309a8d..7a32025 100644 (file)
--- a/util.c
+++ b/util.c
@@ -21,6 +21,7 @@
  */
 
 #include "rsync.h"
+#include "ifuncs.h"
 
 extern int verbose;
 extern int dry_run;
index 595ec42..f58908d 100644 (file)
--- a/xattrs.c
+++ b/xattrs.c
@@ -20,6 +20,7 @@
  */
 
 #include "rsync.h"
+#include "ifuncs.h"
 #include "lib/sysxattrs.h"
 
 #ifdef SUPPORT_XATTRS