From 512acd125e450b748cd2c8f6b02f8e01e0e3a70e Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Sun, 26 Dec 2021 14:23:19 -0800 Subject: Use mallinfo2, when available, and use %zd for size_t values on C99. An exhanced version of pull request #265. --- rsync.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'rsync.h') 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 -- cgit v1.2.1