summaryrefslogtreecommitdiff
path: root/rsync.h
diff options
context:
space:
mode:
authorWayne Davison <wayne@opencoder.net>2021-12-26 14:23:19 -0800
committerWayne Davison <wayne@opencoder.net>2021-12-26 14:25:53 -0800
commit512acd125e450b748cd2c8f6b02f8e01e0e3a70e (patch)
tree1d14a74159bfd3a265aa693039f4acaa247469c8 /rsync.h
parent72adf49ba8cb81426e2b9799fbd43c6284b013a9 (diff)
downloadrsync-512acd125e450b748cd2c8f6b02f8e01e0e3a70e.tar.gz
Use mallinfo2, when available, and use %zd for size_t values on C99.
An exhanced version of pull request #265.
Diffstat (limited to 'rsync.h')
-rw-r--r--rsync.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/rsync.h b/rsync.h
index 86105afe..ea1bfea6 100644
--- a/rsync.h
+++ b/rsync.h
@@ -780,6 +780,11 @@ struct ht_int64_node {
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
#define USE_FLEXIBLE_ARRAY 1
+#define SIZE_T_FMT_MOD "z" /* printf supports %zd */
+#define SIZE_T_FMT_CAST size_t
+#else
+#define SIZE_T_FMT_MOD "l" /* printf supports %ld */
+#define SIZE_T_FMT_CAST long
#endif
union file_extras {
@@ -1473,3 +1478,9 @@ const char *get_panic_action(void);
exit_cleanup(RERR_UNSUPPORTED); \
} while (0)
#endif /* AVX2_ASM */
+
+#ifdef HAVE_MALLINFO2
+#define MEM_ALLOC_INFO mallinfo2
+#elif defined HAVE_MALLINFO
+#define MEM_ALLOC_INFO mallinfo
+#endif