mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-27 08:49:16 +08:00
d2316f866c
Primary Fixes: * Add a whole variable optimization -- used in the rare case that nc_get/put_vara covers the whole of a variable and the variable has a single chunk. * Fix chunking error when stride causes whole chunks to be skipped. * Fix some memory leaks * Add test cases * Add one performance test to nczarr_test/. This uses the timer utils from unit_test: timer_utils.[ch]. * Move ncdumpchunks utility from ncdump to nczarr_test Misc. Other Changes: * Make check for aws libraries conditional on --enable-nczarr-s3 * Remove all but one bm tests from nczarr_test until they are working. * Remove another dependency on HDF5 from supposedly non-HDF5 specific code; specifically hdf5_log_hdf5. * Make the BAIL2 macro be hdf5 specific and replace elsewhere with an HDF5 independent equivalent. * Move hdf5cache.c to libsrc4/nc4cache.c because it is used by nczarr. * Modify unit_tests so that some of them are run even if using Windows. * Misc. small bug fixes and refactors and memory leaks. * Rename some conflicting tests for cmake. * Attempted to make nc_perf work with cmake and failed.
73 lines
1.6 KiB
C
73 lines
1.6 KiB
C
/* Copyright 2018, University Corporation for Atmospheric Research. See
|
|
COPYRIGHT file for copying and redistribution conditions. */
|
|
/**
|
|
* @file @internal This file is part of netcdf-4, a netCDF-like
|
|
* interface for HDF5, or a HDF5 backend for netCDF, depending on your
|
|
* point of view.
|
|
*
|
|
* This file contains macros and prototypes relating to logging.
|
|
*
|
|
* @author Ed Hartnett
|
|
*/
|
|
|
|
#ifndef _NCLOGGING_
|
|
#define _NCLOGGING_
|
|
|
|
#include <stdlib.h>
|
|
#include <assert.h>
|
|
|
|
#ifdef LOGGING
|
|
|
|
/* To log something... */
|
|
void nc_log(int severity, const char *fmt, ...);
|
|
|
|
#define LOG(e) nc_log e
|
|
|
|
/* BAIL2 was moved to libhdf5/hdf5err.h+hdf5internal.c
|
|
because of the call to nc_log_hdf5 */
|
|
|
|
/* Define a replacement for BAIL2 that is not HDF5 dependent */
|
|
#define BAILLOG(e) \
|
|
do { \
|
|
retval = e; \
|
|
LOG((0, "file %s, line %d.\n%s", __FILE__, __LINE__, nc_strerror(e))); \
|
|
} while (0)
|
|
|
|
/* To set retval and jump to exit, without logging error message. */
|
|
#define BAIL_QUIET(e) \
|
|
do { \
|
|
retval = e; \
|
|
goto exit; \
|
|
} while (0)
|
|
|
|
#else /* LOGGING */
|
|
|
|
/* These definitions will be used unless LOGGING is defined. */
|
|
#define LOG(e)
|
|
|
|
#define BAILLOG(e) \
|
|
do { \
|
|
retval = e; \
|
|
} while (0)
|
|
|
|
#define BAIL_QUIET BAIL
|
|
|
|
#ifdef USE_NETCDF4
|
|
#ifndef ENABLE_SET_LOG_LEVEL
|
|
/* Define away any calls to nc_set_log_level(), if its not enabled. */
|
|
#define nc_set_log_level(e)
|
|
#endif /* ENABLE_SET_LOG_LEVEL */
|
|
#endif
|
|
|
|
#endif /* LOGGING */
|
|
|
|
/* To log an error message (if 'LOGGING' is defined), set retval, and jump to exit. */
|
|
#define BAIL(e) \
|
|
do { \
|
|
BAILLOG(e); \
|
|
goto exit; \
|
|
} while (0)
|
|
|
|
#endif /* _NCLOGGING_ */
|
|
|