Skip to content

Commit c9cc541

Browse files
wkliaoJonathanlyj
authored andcommitted
Merge pull request Parallel-NetCDF#158 from Parallel-NetCDF/malloc
Use C macros for malloc if debug and profile modes are disabled
1 parent edb95b1 commit c9cc541

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

examples/C/nonblocking_write.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,10 +398,12 @@ int main(int argc, char **argv)
398398
MPI_Reduce(&put_size, &sum_put_size, 1, MPI_OFFSET, MPI_SUM, 0, MPI_COMM_WORLD);
399399
MPI_Reduce(&write_timing, &max_write_timing, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
400400

401-
/* rank 0 also writes header and updates the record number in header NTIME times */
402-
sum_write_size += header_size + NTIMES * 8;
403-
401+
/* rank 0 also writes header and updates the record number to the file
402+
* header NTIME times
403+
*/
404404
if (rank == 0 && verbose) {
405+
sum_write_size += header_size + NTIMES * 8;
406+
405407
printf("\n");
406408
if (use_bput)
407409
printf("Using PnetCDF nonblocking APIs: bput\n");

src/drivers/common/utf8proc.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
* Copyright (C) 2012, Northwestern University and Argonne National Laboratory
33
* See COPYRIGHT notice in top-level directory.
44
*/
5-
/* $Id$ */
5+
6+
#ifdef HAVE_CONFIG_H
7+
# include <config.h>
8+
#endif
69

710
#include <pnetcdf.h>
811
#include <pnc_debug.h>

src/drivers/include/common.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,17 @@ extern void
7171
NCI_Free_fn(void *ptr, const int lineno, const char *func,
7272
const char *filename);
7373

74-
75-
74+
#if defined(PNETCDF_DEBUG) || defined(PNC_MALLOC_TRACE)
7675
#define NCI_Malloc(a) NCI_Malloc_fn(a,__LINE__,__func__,__FILE__)
7776
#define NCI_Calloc(a,b) NCI_Calloc_fn(a,b,__LINE__,__func__,__FILE__)
7877
#define NCI_Realloc(a,b) NCI_Realloc_fn(a,b,__LINE__,__func__,__FILE__)
7978
#define NCI_Free(a) NCI_Free_fn(a,__LINE__,__func__,__FILE__)
79+
#else
80+
#define NCI_Malloc(a) malloc(a)
81+
#define NCI_Calloc(a,b) calloc(a,b)
82+
#define NCI_Realloc(a,b) realloc(a,b)
83+
#define NCI_Free(a) free(a)
84+
#endif
8085

8186
extern int
8287
ncmpii_inq_malloc_size(size_t *size);

0 commit comments

Comments
 (0)