From ed911fa04354a94cbe09232b3e38011ffe48ed99 Mon Sep 17 00:00:00 2001 From: wkliao Date: Tue, 26 Nov 2024 11:23:17 -0600 Subject: [PATCH 1/3] Use C macros for malloc if debug and profile modes are disabled --- src/drivers/include/common.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/drivers/include/common.h b/src/drivers/include/common.h index 294ecd3fa..22123e076 100644 --- a/src/drivers/include/common.h +++ b/src/drivers/include/common.h @@ -69,10 +69,17 @@ extern void NCI_Free_fn(void *ptr, const int lineno, const char *func, const char *filename); +#if defined(PNETCDF_DEBUG) || defined(PNC_MALLOC_TRACE) #define NCI_Malloc(a) NCI_Malloc_fn(a,__LINE__,__func__,__FILE__) #define NCI_Calloc(a,b) NCI_Calloc_fn(a,b,__LINE__,__func__,__FILE__) #define NCI_Realloc(a,b) NCI_Realloc_fn(a,b,__LINE__,__func__,__FILE__) #define NCI_Free(a) NCI_Free_fn(a,__LINE__,__func__,__FILE__) +#else +#define NCI_Malloc(a) malloc(a) +#define NCI_Calloc(a,b) calloc(a,b) +#define NCI_Realloc(a,b) realloc(a,b) +#define NCI_Free(a) free(a) +#endif extern int ncmpii_inq_malloc_size(size_t *size); From 0c500697702b1f294198a53cd590a5a237b24aa4 Mon Sep 17 00:00:00 2001 From: wkliao Date: Tue, 26 Nov 2024 11:24:37 -0600 Subject: [PATCH 2/3] silence a valgrind warning on uninitialized variable --- examples/C/nonblocking_write.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/examples/C/nonblocking_write.c b/examples/C/nonblocking_write.c index 2f6a48ba6..48284b4ec 100644 --- a/examples/C/nonblocking_write.c +++ b/examples/C/nonblocking_write.c @@ -398,10 +398,12 @@ int main(int argc, char **argv) MPI_Reduce(&put_size, &sum_put_size, 1, MPI_OFFSET, MPI_SUM, 0, MPI_COMM_WORLD); MPI_Reduce(&write_timing, &max_write_timing, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); - /* rank 0 also writes header and updates the record number in header NTIME times */ - sum_write_size += header_size + NTIMES * 8; - + /* rank 0 also writes header and updates the record number to the file + * header NTIME times + */ if (rank == 0 && verbose) { + sum_write_size += header_size + NTIMES * 8; + printf("\n"); if (use_bput) printf("Using PnetCDF nonblocking APIs: bput\n"); From 5d6fdb54bd2786fad0e0f866093b0f78b3a6cac4 Mon Sep 17 00:00:00 2001 From: wkliao Date: Tue, 26 Nov 2024 12:23:19 -0600 Subject: [PATCH 3/3] add missing include of config.h --- src/drivers/common/utf8proc.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/drivers/common/utf8proc.c b/src/drivers/common/utf8proc.c index 37de7bc21..6beb6349b 100644 --- a/src/drivers/common/utf8proc.c +++ b/src/drivers/common/utf8proc.c @@ -2,7 +2,10 @@ * Copyright (C) 2012, Northwestern University and Argonne National Laboratory * See COPYRIGHT notice in top-level directory. */ -/* $Id$ */ + +#ifdef HAVE_CONFIG_H +# include +#endif #include #include