Skip to content

Commit

Permalink
Use C macros for malloc if debug and profile modes are disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
wkliao committed Nov 26, 2024
1 parent 74477fd commit ed911fa
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit ed911fa

Please sign in to comment.