Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use C macros for malloc if debug and profile modes are disabled #158

Merged
merged 3 commits into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions examples/C/nonblocking_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
5 changes: 4 additions & 1 deletion src/drivers/common/utf8proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 <config.h>
#endif

#include <pnetcdf.h>
#include <pnc_debug.h>
Expand Down
7 changes: 7 additions & 0 deletions src/drivers/include/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down