mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-21 08:39:46 +08:00
removed more dead code
This commit is contained in:
commit
7d117cc0ce
@ -381,13 +381,6 @@ OPTION(ENABLE_MMAP "Use MMAP." ON)
|
||||
# Option to use examples.
|
||||
OPTION(ENABLE_EXAMPLES "Build Examples" ON)
|
||||
|
||||
# Option to use Diskless
|
||||
OPTION(ENABLE_DISKLESS "Build Diskless." ON)
|
||||
IF(ENABLE_DISKLESS)
|
||||
SET(BUILD_DISKLESS ON)
|
||||
SET(USE_DISKLESS ON)
|
||||
ENDIF()
|
||||
|
||||
# Option Logging, only valid for netcdf4.
|
||||
OPTION(ENABLE_LOGGING "Enable Logging." OFF)
|
||||
IF(ENABLE_LOGGING)
|
||||
@ -1174,6 +1167,10 @@ IF(ENABLE_DOXYGEN)
|
||||
ENDIF(NC_DOT)
|
||||
ENDIF()
|
||||
|
||||
# Always enable DISKLESS
|
||||
OPTION(ENABLE_DISKLESS "Enable in-memory files" ON)
|
||||
|
||||
|
||||
# By default, MSVC has a stack size of 1000000.
|
||||
# Allow a user to override this.
|
||||
IF(MSVC)
|
||||
@ -1857,7 +1854,7 @@ is_enabled(ENABLE_PARALLEL4 HAS_PARALLEL4)
|
||||
is_enabled(ENABLE_DAP HAS_DAP)
|
||||
is_enabled(ENABLE_DAP HAS_DAP2)
|
||||
is_enabled(ENABLE_DAP4 HAS_DAP4)
|
||||
is_enabled(USE_DISKLESS HAS_DISKLESS)
|
||||
is_enabled(ENABLE_DISKLESS HAS_DISKLESS)
|
||||
is_enabled(USE_MMAP HAS_MMAP)
|
||||
is_enabled(JNA HAS_JNA)
|
||||
is_enabled(STATUS_RELAX_COORD_BOUND RELAX_COORD_BOUND)
|
||||
|
@ -9,7 +9,7 @@ This file contains a high-level description of this package's evolution. Release
|
||||
|
||||
* [Enhancement] Expanded the capabilities of `NC_INMEMORY` to support writing and accessing the final modified memory. See [GitHub #879](https://github.com/Unidata/netcdf-c/pull/879) for more information.
|
||||
* [Enhancement] Made CDF5 support enabled by default. See [Github #931](https://github.com/Unidata/netcdf-c/issues/931) for more information.
|
||||
|
||||
* [Bug Fix] Corrected a number of memory issues identified in `ncgen`. See [GitHub #558 for more information](https://github.com/Unidata/netcdf-c/pull/558).
|
||||
|
||||
## 4.6.1 - March 19, 2018
|
||||
|
||||
|
8
cf
8
cf
@ -87,7 +87,7 @@ LDFLAGS="$TMP $LDFLAGS"
|
||||
TMP=`curl-config --prefix`
|
||||
LD_LIBRARY_PATH="$TMP/lib:$LD_LIBRARY_PATH"
|
||||
else
|
||||
LDFLAGS="${LDFLAGS} -lcurl"
|
||||
LDFLAGS="${LDFLAGS} -lcurl"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -108,7 +108,7 @@ FLAGS="$FLAGS --enable-extreme-numbers"
|
||||
#FLAGS="$FLAGS --enable-dap-auth-tests" -- requires a new remotetest server
|
||||
#FLAGS="$FLAGS --enable-doxygen --enable-internal-docs"
|
||||
FLAGS="$FLAGS --enable-logging"
|
||||
#FLAGS="$FLAGS --disable-diskless"
|
||||
FLAGS="$FLAGS --disable-diskless"
|
||||
#FLAGS="$FLAGS --enable-mmap"
|
||||
#FLAGS="$FLAGS --with-udunits"
|
||||
#FLAGS="$FLAGS --with-libcf"
|
||||
@ -116,8 +116,8 @@ FLAGS="$FLAGS --enable-logging"
|
||||
#FLAGS="$FLAGS --disable-properties-attribute"
|
||||
#FLAGS="$FLAGS --disable-silent-rules"
|
||||
#FLAGS="$FLAGS --with-testservers=remotestserver.localhost:8083"
|
||||
#FLAGS="$FLAGS --disable-filter-testing"
|
||||
FLAGS="$FLAGS --enable-metadata-perf"
|
||||
FLAGS="$FLAGS --disable-filter-testing"
|
||||
#FLAGS="$FLAGS --enable-metadata-perf"
|
||||
|
||||
if test "x$PAR4" != x1 ; then
|
||||
FLAGS="$FLAGS --disable-parallel4"
|
||||
|
25
configure.ac
25
configure.ac
@ -742,20 +742,6 @@ AC_CHECK_FUNCS([strlcat snprintf \
|
||||
mkstemp mktemp random \
|
||||
getrlimit gettimeofday fsync MPI_Comm_f2c])
|
||||
|
||||
# Does the user want to use NC_DISKLESS?
|
||||
AC_MSG_CHECKING([whether in-memory files are enabled])
|
||||
AC_ARG_ENABLE([diskless],
|
||||
[AS_HELP_STRING([--disable-diskless],
|
||||
[disable support for in-memory (NC_DISKLESS) files])])
|
||||
test "x$enable_diskless" = xno || enable_diskless=yes
|
||||
AC_MSG_RESULT($enable_diskless)
|
||||
|
||||
# If DAP enabled and diskless not enabled, then warn of consequences
|
||||
if test "x$enable_dap" = "xyes" -a "x$enable_diskless" = xno ; then
|
||||
AC_MSG_NOTICE([Warning: DAP support is enabled but diskless support is disabled.])
|
||||
AC_MSG_NOTICE([=> temporary files will be created + reclaimed when using DAP.])
|
||||
fi
|
||||
|
||||
# disable dap4 if netcdf-4 is disabled
|
||||
if test "x$enable_netcdf_4" = "xno" ; then
|
||||
AC_MSG_WARN([netcdf-4 not enabled; disabling DAP4])
|
||||
@ -785,12 +771,8 @@ if test "x$ac_cv_func_mmap_fixed_mapped" != xyes -o "x$ac_cv_func_mremap" != xye
|
||||
enable_mmap=no
|
||||
fi
|
||||
|
||||
# Setup the diskless and mmap conditionals
|
||||
if test "x$enable_diskless" = xyes ; then
|
||||
AC_DEFINE([USE_DISKLESS], [1], [if true, include NC_DISKLESS and NC_INMEMORY code])
|
||||
if test "x$enable_mmap" = xyes; then
|
||||
if test "x$enable_mmap" = xyes; then
|
||||
AC_DEFINE([USE_MMAP], [1], [if true, use mmap for in-memory files])
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_FUNC_ALLOCA
|
||||
@ -1211,7 +1193,6 @@ AM_CONDITIONAL(USE_RENAMEV3, [test x$enable_netcdf_4 = xyes -o x$enable_dap = xy
|
||||
AM_CONDITIONAL(BUILD_FORTRAN, [test x$enable_remote_fortran_bootstrap = xyes])
|
||||
AM_CONDITIONAL(USE_PNETCDF, [test x$enable_pnetcdf = xyes])
|
||||
AM_CONDITIONAL(USE_DISPATCH, [test x$enable_dispatch = xyes])
|
||||
AM_CONDITIONAL(BUILD_DISKLESS, [test x$enable_diskless = xyes])
|
||||
AM_CONDITIONAL(BUILD_MMAP, [test x$enable_mmap = xyes])
|
||||
AM_CONDITIONAL(BUILD_DOCS, [test x$enable_doxygen = xyes])
|
||||
AM_CONDITIONAL(SHOW_DOXYGEN_TAG_LIST, [test x$enable_doxygen_tasks = xyes])
|
||||
@ -1345,7 +1326,7 @@ AC_SUBST(HAS_LOGGING, [$enable_logging])
|
||||
AC_SUBST(HAS_SZLIB,[$enable_szlib])
|
||||
AC_SUBST(HAS_PARALLEL,[$enable_parallel])
|
||||
AC_SUBST(HAS_PARALLEL4,[$enable_parallel4])
|
||||
AC_SUBST(HAS_DISKLESS,[$enable_diskless])
|
||||
AC_SUBST(HAS_DISKLESS,[yes])
|
||||
AC_SUBST(HAS_MMAP,[$enable_mmap])
|
||||
AC_SUBST(HAS_JNA,[$enable_jna])
|
||||
AC_SUBST(RELAX_COORD_BOUND,[$enable_relax_coord_bound])
|
||||
@ -1409,7 +1390,7 @@ AX_SET_META([NC_HAS_HDF5],[$enable_netcdf_4],[yes])
|
||||
AX_SET_META([NC_HAS_SZIP],[$ac_cv_func_H5Z_SZIP],[yes])
|
||||
AX_SET_META([NC_HAS_DAP2],[$enable_dap],[yes])
|
||||
AX_SET_META([NC_HAS_DAP4],[$enable_dap4],[yes])
|
||||
AX_SET_META([NC_HAS_DISKLESS],[$enable_diskless],[yes])
|
||||
AX_SET_META([NC_HAS_DISKLESS],[yes],[yes])
|
||||
AX_SET_META([NC_HAS_MMAP],[$enable_mmap],[yes])
|
||||
AX_SET_META([NC_HAS_JNA],[$enable_jna],[yes])
|
||||
AX_SET_META([NC_HAS_PNETCDF],[$enable_pnetcdf],[yes])
|
||||
|
@ -12,9 +12,7 @@ if BUILD_PARALLEL
|
||||
include_HEADERS += netcdf_par.h
|
||||
endif
|
||||
|
||||
if BUILD_DISKLESS
|
||||
include_HEADERS += netcdf_mem.h
|
||||
endif
|
||||
|
||||
noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h nclist.h \
|
||||
ncuri.h ncutf8.h ncdispatch.h ncdimscale.h netcdf_f.h err_macros.h \
|
||||
|
@ -201,6 +201,7 @@ NCD2_initialize(void)
|
||||
int
|
||||
NCD2_finalize(void)
|
||||
{
|
||||
curl_global_cleanup();
|
||||
return NC_NOERR;
|
||||
}
|
||||
|
||||
@ -367,16 +368,13 @@ NCD2_open(const char* path, int mode,
|
||||
/* Now, use the file to create the hidden, in-memory netcdf file.
|
||||
We want this hidden file to always be NC_CLASSIC, so we need to
|
||||
force default format temporarily in case user changed it.
|
||||
If diskless is enabled, then create file in-memory, else
|
||||
create an actual temporary file in the file system.
|
||||
Since diskless is enabled, create file in-memory.
|
||||
*/
|
||||
{
|
||||
int new = 0; /* format netcdf-3 */
|
||||
int old = 0;
|
||||
int ncflags = NC_CLOBBER|NC_CLASSIC_MODEL;
|
||||
#ifdef USE_DISKLESS
|
||||
ncflags |= NC_DISKLESS;
|
||||
#endif
|
||||
nc_set_default_format(new,&old); /* save and change */
|
||||
ncstat = nc_create(tmpname,ncflags,&nc3id);
|
||||
nc_set_default_format(old,&new); /* restore */
|
||||
|
@ -101,17 +101,14 @@ NCD4_open(const char * path, int mode,
|
||||
/* Now, use the file to create the hidden substrate netcdf file.
|
||||
We want this hidden file to always be NC_NETCDF4, so we need to
|
||||
force default format temporarily in case user changed it.
|
||||
If diskless is enabled, then create file in-memory, else
|
||||
create an actual temporary file in the file system.
|
||||
Since diskless is enabled, create file in-memory.
|
||||
*/
|
||||
{
|
||||
int new = NC_NETCDF4;
|
||||
int old = 0;
|
||||
int ncid = 0;
|
||||
int ncflags = NC_NETCDF4|NC_CLOBBER;
|
||||
#ifdef USE_DISKLESS
|
||||
ncflags |= NC_DISKLESS;
|
||||
#endif
|
||||
if(FLAGSET(d4info->controls.debugflags,NCF_DEBUG_COPY)) {
|
||||
/* Cause data to be dumped to real file */
|
||||
ncflags |= NC_WRITE;
|
||||
|
@ -41,11 +41,6 @@ defined here, including function-like #defines.
|
||||
/* Clear empty structure alignment space; Potentially costly, but probably less than CLEARMEM */
|
||||
#define CLEARSTRUCT
|
||||
|
||||
/**************************************************/
|
||||
/* Global state */
|
||||
|
||||
extern NCD4globalstate* NCD4_globalstate;
|
||||
|
||||
/**************************************************/
|
||||
|
||||
#undef nullfree
|
||||
|
@ -34,9 +34,6 @@ static NC_Dispatch NCD4_dispatch_base;
|
||||
|
||||
NC_Dispatch* NCD4_dispatch_table = NULL; /* moved here from ddispatch.c */
|
||||
|
||||
/* Collect global state info in one place */
|
||||
NCD4globalstate* NCD4_globalstate = NULL;
|
||||
|
||||
/* Forward */
|
||||
static int globalinit(void);
|
||||
|
||||
@ -63,6 +60,7 @@ NCD4_initialize(void)
|
||||
int
|
||||
NCD4_finalize(void)
|
||||
{
|
||||
curl_global_cleanup();
|
||||
return THROW(NC_NOERR);
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,6 @@ typedef enum NCD4mode NCD4mode;
|
||||
typedef enum NCD4translation NCD4translation;
|
||||
typedef struct NCD4curl NCD4curl;
|
||||
typedef struct NCD4meta NCD4meta;
|
||||
typedef struct NCD4globalstate NCD4globalstate;
|
||||
typedef struct NCD4node NCD4node;
|
||||
typedef struct NCD4params NCD4params;
|
||||
|
||||
|
@ -573,14 +573,10 @@ named foo.nc. The initial size is set to 4096.
|
||||
int
|
||||
nc_create_mem(const char* path, int mode, size_t initialsize, int* ncidp)
|
||||
{
|
||||
#ifdef USE_DISKLESS
|
||||
if(mode & (NC_MPIIO|NC_MPIPOSIX|NC_MMAP))
|
||||
return NC_EINVAL;
|
||||
mode |= (NC_INMEMORY|NC_NOCLOBBER); /* Specifically, do not set NC_DISKLESS */
|
||||
return NC_create(path, mode, initialsize, 0, NULL, 0, NULL, ncidp);
|
||||
#else
|
||||
return NC_EDISKLESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -838,7 +834,6 @@ if (status != NC_NOERR) handle_error(status);
|
||||
int
|
||||
nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp)
|
||||
{
|
||||
#ifdef USE_DISKLESS
|
||||
NC_memio meminfo;
|
||||
|
||||
/* Sanity checks */
|
||||
@ -851,9 +846,6 @@ nc_open_mem(const char* path, int mode, size_t size, void* memory, int* ncidp)
|
||||
meminfo.memory = memory;
|
||||
meminfo.flags = NC_MEMIO_LOCKED;
|
||||
return NC_open(path, mode, 0, NULL, 0, &meminfo, ncidp);
|
||||
#else
|
||||
return NC_EDISKLESS;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \ingroup datasets
|
||||
@ -907,7 +899,6 @@ if (status != NC_NOERR) handle_error(status);
|
||||
int
|
||||
nc_open_memio(const char* path, int mode, NC_memio* params, int* ncidp)
|
||||
{
|
||||
#ifdef USE_DISKLESS
|
||||
/* Sanity checks */
|
||||
if(path == NULL || params == NULL)
|
||||
return NC_EINVAL;
|
||||
@ -917,9 +908,6 @@ nc_open_memio(const char* path, int mode, NC_memio* params, int* ncidp)
|
||||
return NC_EINVAL;
|
||||
mode |= (NC_INMEMORY);
|
||||
return NC_open(path, mode, 0, NULL, 0, params, ncidp);
|
||||
#else
|
||||
return NC_EINMEMORY;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1441,7 +1429,6 @@ and release its netCDF ID:
|
||||
int
|
||||
nc_close_memio(int ncid, NC_memio* memio)
|
||||
{
|
||||
#ifdef USE_DISKLESS
|
||||
NC* ncp;
|
||||
int stat = NC_check_id(ncid, &ncp);
|
||||
if(stat != NC_NOERR) return stat;
|
||||
@ -1460,9 +1447,6 @@ nc_close_memio(int ncid, NC_memio* memio)
|
||||
}
|
||||
}
|
||||
return stat;
|
||||
#else
|
||||
return NC_EINMEMORY;
|
||||
#endif
|
||||
}
|
||||
|
||||
/** \ingroup datasets
|
||||
@ -1879,14 +1863,6 @@ check_create_mode(int mode)
|
||||
(mode & NC_MPIPOSIX && mode & NC_DISKLESS))
|
||||
return NC_EINVAL;
|
||||
|
||||
#ifndef USE_DISKLESS
|
||||
/* If diskless is requested, but not built, return error. */
|
||||
if (mode & NC_DISKLESS)
|
||||
return NC_ENOTBUILT;
|
||||
if (mode & NC_INMEMORY)
|
||||
return NC_ENOTBUILT;
|
||||
#endif
|
||||
|
||||
#ifndef USE_NETCDF4
|
||||
/* If the user asks for a netCDF-4 file, and the library was built
|
||||
* without netCDF-4, then return an error.*/
|
||||
@ -1963,10 +1939,6 @@ NC_create(const char *path0, int cmode, size_t initialsz,
|
||||
return stat;
|
||||
}
|
||||
|
||||
#ifndef USE_DISKLESS
|
||||
cmode &= (~ (NC_DISKLESS|NC_INMEMORY)); /* Force off */
|
||||
#endif
|
||||
|
||||
#ifdef WINPATH
|
||||
/* Need to do path conversion */
|
||||
path = NCpathcvt(path0);
|
||||
@ -2152,11 +2124,6 @@ NC_open(const char *path0, int cmode, int basepe, size_t *chunksizehintp,
|
||||
repeated in protocol code: libdap2 and libdap4
|
||||
*/
|
||||
|
||||
#ifndef USE_DISKLESS
|
||||
/* Clean up cmode */
|
||||
cmode &= (~ (NC_DISKLESS|NC_INMEMORY));
|
||||
#endif
|
||||
|
||||
inmemory = ((cmode & NC_INMEMORY) == NC_INMEMORY);
|
||||
diskless = ((cmode & NC_DISKLESS) == NC_DISKLESS);
|
||||
|
||||
|
@ -14,13 +14,11 @@ SET(libsrc_SOURCES v1hpg.c putget.c attr.c nc3dispatch.c
|
||||
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} pstdint.h ncio.h ncx.h)
|
||||
|
||||
IF (BUILD_DISKLESS)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} memio.c)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} memio.c)
|
||||
|
||||
IF (BUILD_MMAP)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} mmapio.c)
|
||||
ENDIF( BUILD_MMAP)
|
||||
ENDIF (BUILD_DISKLESS)
|
||||
IF (BUILD_MMAP)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} mmapio.c)
|
||||
ENDIF( BUILD_MMAP)
|
||||
|
||||
IF (USE_FFIO)
|
||||
SET(libsrc_SOURCES ${libsrc_SOURCES} ffio.c)
|
||||
|
@ -11,14 +11,11 @@ libnetcdf3_la_CPPFLAGS = ${AM_CPPFLAGS}
|
||||
# These files comprise the netCDF-3 classic library code.
|
||||
libnetcdf3_la_SOURCES = v1hpg.c \
|
||||
putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c \
|
||||
ncx.h lookup3.c pstdint.h ncio.c ncio.h
|
||||
ncx.h lookup3.c pstdint.h ncio.c ncio.h memio.c
|
||||
|
||||
if BUILD_DISKLESS
|
||||
libnetcdf3_la_SOURCES += memio.c
|
||||
if BUILD_MMAP
|
||||
libnetcdf3_la_SOURCES += mmapio.c
|
||||
endif BUILD_MMAP
|
||||
endif BUILD_DISKLESS
|
||||
|
||||
# Does the user want to use ffio, a replacement for posixio for Cray
|
||||
# computers?
|
||||
|
@ -30,14 +30,12 @@ extern int ffio_create(const char*,int,size_t,off_t,size_t,size_t*,void*,ncio**,
|
||||
extern int ffio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
|
||||
#endif
|
||||
|
||||
#ifdef USE_DISKLESS
|
||||
# ifdef USE_MMAP
|
||||
extern int mmapio_create(const char*,int,size_t,off_t,size_t,size_t*,void*,ncio**,void** const);
|
||||
extern int mmapio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
|
||||
# endif
|
||||
extern int memio_create(const char*,int,size_t,off_t,size_t,size_t*,void*,ncio**,void** const);
|
||||
extern int memio_open(const char*,int,off_t,size_t,size_t*,void*,ncio**,void** const);
|
||||
#endif
|
||||
|
||||
int
|
||||
ncio_create(const char *path, int ioflags, size_t initialsz,
|
||||
@ -45,7 +43,6 @@ ncio_create(const char *path, int ioflags, size_t initialsz,
|
||||
void* parameters,
|
||||
ncio** iopp, void** const mempp)
|
||||
{
|
||||
#ifdef USE_DISKLESS
|
||||
if(fIsSet(ioflags,NC_INMEMORY)) {
|
||||
# ifdef USE_MMAP
|
||||
if(fIsSet(ioflags,NC_MMAP) && fIsSet(ioflags, NC_DISKLESS))
|
||||
@ -54,7 +51,6 @@ ncio_create(const char *path, int ioflags, size_t initialsz,
|
||||
# endif /*USE_MMAP*/
|
||||
return memio_create(path,ioflags,initialsz,igeto,igetsz,sizehintp,parameters,iopp,mempp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_STDIO
|
||||
return stdio_create(path,ioflags,initialsz,igeto,igetsz,sizehintp,parameters,iopp,mempp);
|
||||
@ -74,7 +70,6 @@ ncio_open(const char *path, int ioflags,
|
||||
/* Diskless open has the following constraints:
|
||||
1. file must be classic version 1 or 2 or 5
|
||||
*/
|
||||
#ifdef USE_DISKLESS
|
||||
if(fIsSet(ioflags,NC_INMEMORY)) {
|
||||
# ifdef USE_MMAP
|
||||
if(fIsSet(ioflags,NC_MMAP) && fIsSet(ioflags, NC_DISKLESS))
|
||||
@ -83,7 +78,6 @@ ncio_open(const char *path, int ioflags,
|
||||
# endif /*USE_MMAP*/
|
||||
return memio_open(path,ioflags,igeto,igetsz,sizehintp,parameters,iopp,mempp);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_STDIO
|
||||
return stdio_open(path,ioflags,igeto,igetsz,sizehintp,parameters,iopp,mempp);
|
||||
#elif defined(USE_FFIO)
|
||||
|
@ -52,9 +52,7 @@ ncstdio_uid(ncstdio* ncstdiop,int*);
|
||||
extern int ncFile_create(const char *path, int ioflags, ncstdio** filepp);
|
||||
extern int ncFile_open(const char *path, int ioflags, ncstdio** filepp);
|
||||
|
||||
#ifdef USE_DISKLESS
|
||||
extern int ncMemory_create(const char *path, int ioflags, ncstdio** filepp);
|
||||
extern int ncMemory_open(const char *path, int ioflags, ncstdio** filepp);
|
||||
#endif
|
||||
|
||||
#endif /* _NCSTDIO_H_* /
|
||||
|
@ -52,11 +52,9 @@ IF(LARGE_FILE_TESTS)
|
||||
|
||||
ENDIF()
|
||||
|
||||
IF(BUILD_DISKLESS)
|
||||
SET(TESTFILES ${TESTFILES} tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory)
|
||||
IF(USE_NETCDF4)
|
||||
SET(TESTFILES ${TESTFILES} tst_diskless2)
|
||||
ENDIF()
|
||||
SET(TESTFILES ${TESTFILES} tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory)
|
||||
IF(USE_NETCDF4)
|
||||
SET(TESTFILES ${TESTFILES} tst_diskless2)
|
||||
ENDIF()
|
||||
|
||||
# Build executables required for the shell scripts.
|
||||
@ -73,7 +71,6 @@ ADD_TEST(nc_test ${EXECUTABLE_OUTPUT_PATH}/nc_test)
|
||||
|
||||
IF(BUILD_UTILITIES)
|
||||
|
||||
IF(BUILD_DISKLESS)
|
||||
add_sh_test(nc_test run_diskless)
|
||||
IF(BUILD_MMAP)
|
||||
add_sh_test(nc_test run_mmap)
|
||||
@ -85,7 +82,6 @@ IF(BUILD_UTILITIES)
|
||||
add_sh_test(nc_test run_diskless5)
|
||||
add_sh_test(nc_test run_inmemory)
|
||||
|
||||
ENDIF(BUILD_DISKLESS)
|
||||
ENDIF(BUILD_UTILITIES)
|
||||
|
||||
# Copy some test files from current source dir to out-of-tree build dir.
|
||||
|
@ -1,5 +1,5 @@
|
||||
# Test c output
|
||||
T=tst_inmemory
|
||||
T=tst_diskless
|
||||
|
||||
#ARGS=t
|
||||
|
||||
|
@ -53,17 +53,14 @@ endif
|
||||
check_PROGRAMS = $(TESTPROGRAMS)
|
||||
|
||||
# Build Diskless test helpers
|
||||
if BUILD_DISKLESS
|
||||
check_PROGRAMS += tst_diskless tst_diskless3 tst_diskless4 tst_diskless5 tst_inmemory
|
||||
if USE_NETCDF4
|
||||
check_PROGRAMS += tst_diskless2
|
||||
endif
|
||||
endif
|
||||
|
||||
TESTS = $(TESTPROGRAMS)
|
||||
|
||||
if BUILD_UTILITIES
|
||||
if BUILD_DISKLESS
|
||||
TESTS += run_diskless.sh run_diskless5.sh run_inmemory.sh
|
||||
if BUILD_MMAP
|
||||
TESTS += run_mmap.sh
|
||||
@ -73,7 +70,6 @@ if LARGE_FILE_TESTS
|
||||
TESTS += run_diskless2.sh
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
if USE_PNETCDF
|
||||
TESTS += run_pnetcdf_test.sh
|
||||
|
@ -97,13 +97,10 @@ fail(int line) {
|
||||
#define ERR fail(__LINE__)
|
||||
#endif
|
||||
|
||||
/* Store any error message */
|
||||
static char errmsg[4096];
|
||||
|
||||
static int
|
||||
check(int stat, const char* file, int line, int xfail)
|
||||
{
|
||||
int pass = ((!xfail && stat == NC_NOERR) || (xfail && stat != NC_NOERR));
|
||||
/* int pass = ((!xfail && stat == NC_NOERR) || (xfail && stat != NC_NOERR)); */
|
||||
fflush(stdout);
|
||||
if(!xfail) {
|
||||
if(stat != NC_NOERR) {
|
||||
@ -195,7 +192,6 @@ writefile(const char* path, NC_memio* memio)
|
||||
int status = NC_NOERR;
|
||||
FILE* f = NULL;
|
||||
size_t count = 0;
|
||||
char* memory = NULL;
|
||||
char* p = NULL;
|
||||
|
||||
/* Open the file for writing */
|
||||
@ -362,7 +358,6 @@ verify_file(int ncid, int modified)
|
||||
float float_data_in;
|
||||
int milesdata_in[MAXDIMLEN];
|
||||
int dimprod = UNLIM_LEN * DIM1_LEN;
|
||||
int modcount = (modified?1:0);
|
||||
|
||||
CHECK(nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdimid_in));
|
||||
if (ndims_in != 2 || nvars_in != NVARS+modified || natts_in != 1 || unlimdimid_in != 0)
|
||||
@ -607,8 +602,6 @@ int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
int stat = NC_NOERR;
|
||||
int i;
|
||||
void* filedata = NULL;
|
||||
NC_memio filedata3;
|
||||
NC_memio filedata4;
|
||||
|
||||
|
@ -71,16 +71,6 @@ main(int argc, char **argv)
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
#endif /* USE_NETCDF4 undefined */
|
||||
#ifndef USE_DISKLESS
|
||||
printf("*** Trying to create diskless file without diskless...");
|
||||
{
|
||||
int ncid;
|
||||
|
||||
if (nc_create(FILE_NAME, NC_DISKLESS, &ncid) != NC_ENOTBUILT)
|
||||
ERR;
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
#endif /* USE_DISKLESS undefined */
|
||||
|
||||
#ifdef TEST_PNETCDF
|
||||
MPI_Finalize();
|
||||
|
@ -140,12 +140,10 @@ ENDIF(MSVC)
|
||||
ENDIF(ENABLE_LARGE_FILE_TESTS)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCC OR APPLE)
|
||||
|
||||
IF(BUILD_DISKLESS)
|
||||
add_sh_test(ncdump tst_inmemory_nc3)
|
||||
IF(USE_NETCDF4)
|
||||
add_sh_test(ncdump tst_inmemory_nc3)
|
||||
IF(USE_NETCDF4)
|
||||
add_sh_test(ncdump tst_inmemory_nc4)
|
||||
ENDIF(USE_NETCDF4)
|
||||
ENDIF(BUILD_DISKLESS)
|
||||
ENDIF(USE_NETCDF4)
|
||||
|
||||
IF(USE_NETCDF4)
|
||||
build_bin_test_no_prefix(tst_create_files)
|
||||
|
@ -90,13 +90,10 @@ tst_nccopy4.log: run_ncgen_tests.log tst_output.log tst_ncgen4.log \
|
||||
tst_fillbug.log tst_netcdf4_4.log tst_h_scalar.log
|
||||
endif #!USE_NETCDF4
|
||||
|
||||
# Add diskless checks if needed.
|
||||
if BUILD_DISKLESS
|
||||
TESTS += tst_inmemory_nc3.sh
|
||||
if USE_NETCDF4
|
||||
TESTS += tst_inmemory_nc4.sh
|
||||
endif
|
||||
endif
|
||||
|
||||
endif BUILD_TESTSETS
|
||||
|
||||
|
@ -315,7 +315,6 @@ kind_string_extended(int kind, int mode)
|
||||
return text;
|
||||
}
|
||||
|
||||
#ifdef USE_DISKLESS
|
||||
static int
|
||||
fileopen(const char* path, void** memp, size_t* sizep)
|
||||
{
|
||||
@ -388,7 +387,6 @@ done:
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Emit initial line of output for NcML
|
||||
@ -2311,7 +2309,6 @@ main(int argc, char *argv[])
|
||||
/* else fall thru and treat like a file path */
|
||||
}
|
||||
#endif /*USE_DAP*/
|
||||
#ifdef USE_DISKLESS
|
||||
if(formatting_specs.xopt_inmemory) {
|
||||
size_t size = 0;
|
||||
void* mem = NULL;
|
||||
@ -2319,7 +2316,6 @@ main(int argc, char *argv[])
|
||||
if(nc_status == NC_NOERR)
|
||||
nc_status = nc_open_mem(path,NC_DISKLESS|NC_INMEMORY,size,mem,&ncid);
|
||||
} else
|
||||
#endif
|
||||
nc_status = nc_open(path, NC_NOWRITE, &ncid);
|
||||
if (nc_status != NC_NOERR) {
|
||||
error("%s: %s", path, nc_strerror(nc_status));
|
||||
|
@ -1,11 +1,11 @@
|
||||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
# Tests for ncgen4 using list of test cdl files from the cdl4
|
||||
# directory, and comparing output to expected results in the expected4
|
||||
# directory. Note that these tests are run for classic files in
|
||||
# tst_ncgen4_classic.sh
|
||||
# Dennis Heimbigner
|
||||
|
||||
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
||||
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
||||
. ../test_common.sh
|
||||
|
||||
set -e
|
||||
@ -17,22 +17,21 @@ set -e
|
||||
# 3. Modify the file tst_ncgen_shared.sh to add
|
||||
# the test to the end of the TESTS4 variable
|
||||
# 4. Add the new files into cdl4/Makefile.am
|
||||
# and expected4/Makefile.am
|
||||
# and expected4/Makefile.am
|
||||
|
||||
verbose=1
|
||||
export verbose
|
||||
|
||||
KFLAG=3 ; export KFLAG
|
||||
echo "*** Performing diff tests: k=3"
|
||||
sh ${srcdir}/tst_ncgen4_diff.sh
|
||||
bash ${srcdir}/tst_ncgen4_diff.sh
|
||||
echo "*** Performing cycle tests: k=3"
|
||||
sh ${srcdir}/tst_ncgen4_cycle.sh
|
||||
bash ${srcdir}/tst_ncgen4_cycle.sh
|
||||
KFLAG=4 ; export KFLAG
|
||||
echo "*** Performing diff tests: k=4"
|
||||
sh ${srcdir}/tst_ncgen4_diff.sh
|
||||
bash ${srcdir}/tst_ncgen4_diff.sh
|
||||
echo "*** Performing cycle tests: k=4"
|
||||
sh ${srcdir}/tst_ncgen4_cycle.sh
|
||||
bash ${srcdir}/tst_ncgen4_cycle.sh
|
||||
rm -rf ${RESULTSDIR}
|
||||
echo "SUCCESS!!"
|
||||
exit 0
|
||||
|
||||
|
@ -86,7 +86,7 @@ bin_constant(Generator* generator, Symbol* sym, NCConstant* con, Bytebuffer* buf
|
||||
char* nil = NULL;
|
||||
bbAppendn(buf,(void*)&nil,sizeof(nil));
|
||||
} else {
|
||||
ptr = (char*)malloc(len+1);
|
||||
ptr = (char*)ecalloc(len+1);
|
||||
memcpy(ptr,con->value.stringv.stringv,len);
|
||||
ptr[len] = '\0';
|
||||
bbAppendn(buf,(void*)&ptr,sizeof(ptr));
|
||||
|
@ -28,14 +28,14 @@ bbFail(void)
|
||||
fflush(stdout);
|
||||
fprintf(stderr,"bytebuffer failure\n");
|
||||
fflush(stderr);
|
||||
if(bbdebug) exit(1);
|
||||
if(bbdebug) abort();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Bytebuffer*
|
||||
bbNew(void)
|
||||
{
|
||||
Bytebuffer* bb = (Bytebuffer*)emalloc(sizeof(Bytebuffer));
|
||||
Bytebuffer* bb = (Bytebuffer*)malloc(sizeof(Bytebuffer));
|
||||
if(bb == NULL) return (Bytebuffer*)bbFail();
|
||||
bb->alloc=0;
|
||||
bb->length=0;
|
||||
@ -53,7 +53,7 @@ bbSetalloc(Bytebuffer* bb, const unsigned int sz0)
|
||||
if(sz <= 0) {sz = (bb->alloc?2*bb->alloc:DEFAULTALLOC);}
|
||||
else if(bb->alloc >= sz) return TRUE;
|
||||
else if(bb->nonextendible) return bbFail();
|
||||
newcontent=(char*)ecalloc(sz,sizeof(char));
|
||||
newcontent=(char*)calloc(sz,sizeof(char));
|
||||
if(bb->alloc > 0 && bb->length > 0 && bb->content != NULL) {
|
||||
memcpy((void*)newcontent,(void*)bb->content,sizeof(char)*bb->length);
|
||||
}
|
||||
@ -250,7 +250,7 @@ bbTailpeek(Bytebuffer* bb, char* pelem)
|
||||
char*
|
||||
bbDup(const Bytebuffer* bb)
|
||||
{
|
||||
char* result = (char*)emalloc(bb->length+1);
|
||||
char* result = (char*)malloc(bb->length+1);
|
||||
memcpy((void*)result,(const void*)bb->content,bb->length);
|
||||
result[bb->length] = '\0'; /* just in case it is a string*/
|
||||
return result;
|
||||
|
@ -323,7 +323,7 @@ genbin_vlenconstants(List* vlenconstants)
|
||||
/* Prepare a place to store vlen constants */
|
||||
nvlen = listlength(vlenconstants);
|
||||
if(nvlen == 0) return;
|
||||
vlendata = (struct Vlendata*)emalloc(sizeof(struct Vlendata)*nvlen+1);
|
||||
vlendata = (struct Vlendata*)ecalloc(sizeof(struct Vlendata)*nvlen+1);
|
||||
memset((void*)vlendata,0,sizeof(struct Vlendata)*nvlen+1);
|
||||
|
||||
for(i=0;i<nvlen;i++) {
|
||||
|
@ -440,7 +440,7 @@ case CASE(NC_STRING,NC_CHAR):
|
||||
case CASE(NC_STRING,NC_STRING):
|
||||
/* Need to watch out for embedded NULs */
|
||||
tmp.stringv.len = src->value.stringv.len;
|
||||
tmp.stringv.stringv = (char*)malloc(src->value.stringv.len+1);
|
||||
tmp.stringv.stringv = (char*)ecalloc(src->value.stringv.len+1);
|
||||
memcpy((void*)tmp.stringv.stringv,
|
||||
(void*)src->value.stringv.stringv,
|
||||
tmp.stringv.len);
|
||||
@ -549,7 +549,7 @@ case CASE(NC_OPAQUE,NC_DOUBLE):
|
||||
tmp.doublev = *(double*)bytes;
|
||||
break;
|
||||
case CASE(NC_OPAQUE,NC_OPAQUE):
|
||||
tmp.opaquev.stringv = (char*)malloc(src->value.opaquev.len+1);
|
||||
tmp.opaquev.stringv = (char*)ecalloc(src->value.opaquev.len+1);
|
||||
memcpy(tmp.opaquev.stringv,src->value.opaquev.stringv,src->value.opaquev.len);
|
||||
tmp.opaquev.len = src->value.opaquev.len;
|
||||
tmp.opaquev.stringv[tmp.opaquev.len] = '\0';
|
||||
@ -590,7 +590,7 @@ setprimlength(NCConstant* prim, unsigned long len)
|
||||
prim->value.stringv.len = len;
|
||||
} else {/* prim->value.stringv.len > srcov->len*/
|
||||
char* s;
|
||||
s = (char*)emalloc(len+1);
|
||||
s = (char*)ecalloc(len+1);
|
||||
memset(s,NC_FILL_CHAR,len);
|
||||
s[len] = '\0';
|
||||
memcpy(s,prim->value.stringv.stringv,prim->value.stringv.len);
|
||||
@ -609,7 +609,7 @@ setprimlength(NCConstant* prim, unsigned long len)
|
||||
prim->value.opaquev.len = len;
|
||||
} else {/* prim->value.opaquev.len < len => expand*/
|
||||
char* s;
|
||||
s = (char*)emalloc(len+1);
|
||||
s = (char*)ecalloc(len+1);
|
||||
memset(s,'0',len);
|
||||
memcpy(s,prim->value.opaquev.stringv,prim->value.opaquev.len);
|
||||
s[len] = '\0';
|
||||
|
36
ncgen/data.c
36
ncgen/data.c
@ -84,7 +84,7 @@ Datasrc*
|
||||
allocdatasrc(void)
|
||||
{
|
||||
Datasrc* src;
|
||||
src = emalloc(sizeof(Datasrc));
|
||||
src = ecalloc(sizeof(Datasrc));
|
||||
src->data = NULL;
|
||||
src->index = 0;
|
||||
src->length = 0;
|
||||
@ -274,13 +274,13 @@ cloneconstant(NCConstant* con)
|
||||
char* s;
|
||||
switch (newcon.nctype) {
|
||||
case NC_STRING:
|
||||
s = (char*)emalloc(newcon.value.stringv.len+1);
|
||||
s = (char*)ecalloc(newcon.value.stringv.len+1);
|
||||
memcpy(s,newcon.value.stringv.stringv,newcon.value.stringv.len);
|
||||
s[newcon.value.stringv.len] = '\0';
|
||||
newcon.value.stringv.stringv = s;
|
||||
break;
|
||||
case NC_OPAQUE:
|
||||
s = (char*)emalloc(newcon.value.opaquev.len+1);
|
||||
s = (char*)ecalloc(newcon.value.opaquev.len+1);
|
||||
memcpy(s,newcon.value.opaquev.stringv,newcon.value.opaquev.len);
|
||||
s[newcon.value.opaquev.len] = '\0';
|
||||
newcon.value.opaquev.stringv = s;
|
||||
@ -675,7 +675,7 @@ indented(int n)
|
||||
{
|
||||
char* indentation;
|
||||
if(dent == NULL) {
|
||||
dent = (char*)emalloc(INDENTMAX+1);
|
||||
dent = (char*)ecalloc(INDENTMAX+1);
|
||||
memset((void*)dent,' ',INDENTMAX);
|
||||
dent[INDENTMAX] = '\0';
|
||||
}
|
||||
@ -688,22 +688,13 @@ void
|
||||
dlextend(Datalist* dl)
|
||||
{
|
||||
size_t newalloc;
|
||||
newalloc = (dl->alloc > 0?2*dl->alloc:1);
|
||||
dlsetalloc(dl,newalloc);
|
||||
}
|
||||
|
||||
void
|
||||
dlsetalloc(Datalist* dl, size_t newalloc)
|
||||
{
|
||||
NCConstant* newdata;
|
||||
if(newalloc <= 0) newalloc = 1;
|
||||
if(dl->alloc > 0)
|
||||
newdata = (NCConstant*)erealloc((void*)dl->data,sizeof(NCConstant)*newalloc);
|
||||
else {
|
||||
newdata = (NCConstant*)emalloc(sizeof(NCConstant)*newalloc);
|
||||
memset((void*)newdata,0,sizeof(NCConstant)*newalloc);
|
||||
}
|
||||
NCConstant* newdata = NULL;
|
||||
newalloc = (dl->alloc > 0?2*dl->alloc:2);
|
||||
newdata = (NCConstant*)ecalloc(newalloc*sizeof(NCConstant));
|
||||
if(dl->length > 0)
|
||||
memcpy(newdata,dl->data,sizeof(NCConstant)*dl->length);
|
||||
dl->alloc = newalloc;
|
||||
nullfree(dl->data);
|
||||
dl->data = newdata;
|
||||
}
|
||||
|
||||
@ -714,9 +705,9 @@ builddatalist(int initial)
|
||||
Datalist* ci;
|
||||
if(initial <= 0) initial = DATALISTINIT;
|
||||
initial++; /* for header*/
|
||||
ci = (Datalist*)emalloc(sizeof(Datalist));
|
||||
ci = (Datalist*)ecalloc(sizeof(Datalist));
|
||||
memset((void*)ci,0,sizeof(Datalist)); /* only clear the hdr*/
|
||||
ci->data = (NCConstant*)emalloc(sizeof(NCConstant)*initial);
|
||||
ci->data = (NCConstant*)ecalloc(sizeof(NCConstant)*initial);
|
||||
memset((void*)ci->data,0,sizeof(NCConstant)*initial);
|
||||
ci->alloc = initial;
|
||||
ci->length = 0;
|
||||
@ -726,7 +717,8 @@ builddatalist(int initial)
|
||||
void
|
||||
dlappend(Datalist* dl, NCConstant* constant)
|
||||
{
|
||||
if(dl->length >= dl->alloc) dlextend(dl);
|
||||
if(dl->length >= dl->alloc)
|
||||
dlextend(dl);
|
||||
if(constant == NULL) constant = &nullconstant;
|
||||
dl->data[dl->length++] = *constant;
|
||||
}
|
||||
|
@ -1,9 +1,7 @@
|
||||
/*********************************************************************
|
||||
* Copyright 2009, UCAR/Unidata
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*********************************************************************/
|
||||
/* $Id: debug.c,v 1.2 2010/05/24 19:59:57 dmh Exp $ */
|
||||
/* $Header: /upc/share/CVS/netcdf-3/ncgen/debug.c,v 1.2 2010/05/24 19:59:57 dmh Exp $ */
|
||||
/*
|
||||
Copyright (c) 1998-2017 University Corporation for Atmospheric Research/Unidata
|
||||
See LICENSE.txt for license information.
|
||||
*/
|
||||
|
||||
#include "includes.h"
|
||||
|
||||
@ -26,21 +24,23 @@ void fdebug(const char *fmt, ...)
|
||||
/**************************************************/
|
||||
|
||||
/* Support debugging of memory*/
|
||||
/* Also guarantee that calloc zeros memory*/
|
||||
void*
|
||||
chkcalloc(size_t size, size_t nelems)
|
||||
|
||||
void
|
||||
chkfree(void* memory)
|
||||
{
|
||||
return chkmalloc(size*nelems);
|
||||
if(memory == NULL) {
|
||||
panic("free: null memory");
|
||||
}
|
||||
free(memory);
|
||||
}
|
||||
|
||||
void*
|
||||
chkmalloc(size_t size)
|
||||
chkcalloc(size_t size)
|
||||
{
|
||||
void* memory = calloc(size,1); /* use calloc to zero memory*/
|
||||
if(memory == NULL) {
|
||||
panic("malloc:out of memory");
|
||||
}
|
||||
memset(memory,0,size);
|
||||
return memory;
|
||||
}
|
||||
|
||||
@ -54,10 +54,18 @@ chkrealloc(void* ptr, size_t size)
|
||||
return memory;
|
||||
}
|
||||
|
||||
void
|
||||
chkfree(void* mem)
|
||||
char*
|
||||
chkstrdup(const char* s)
|
||||
{
|
||||
if(mem != NULL) free(mem);
|
||||
char* dup;
|
||||
if(s == NULL) {
|
||||
panic("strdup: null argument");
|
||||
}
|
||||
dup = strdup(s);
|
||||
if(dup == NULL) {
|
||||
panic("strdup: out of memory");
|
||||
}
|
||||
return dup;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -43,18 +43,22 @@ extern void fdebug(const char *fmt, ...);
|
||||
extern int panic(const char* fmt, ...);
|
||||
|
||||
/*
|
||||
Provide wrapped versions of calloc and malloc.
|
||||
The wrapped version panics if memory is exhausted.
|
||||
Provide wrapped versions of XXXalloc for debugging/
|
||||
The wrapped version:
|
||||
1. fails if size is zero or memory is NULL
|
||||
2. fails if memory is exhausted.
|
||||
3. zeros all allocated memory.
|
||||
*/
|
||||
|
||||
#define ecalloc(x,y) chkcalloc(x,y)
|
||||
#define emalloc(x) chkmalloc(x)
|
||||
#define ecalloc(x) chkcalloc(x) /*note only single arg */
|
||||
#define erealloc(p,x) chkrealloc(p,x)
|
||||
#define efree(x) chkfree(x)
|
||||
extern void* chkcalloc(size_t, size_t);
|
||||
extern void* chkmalloc(size_t);
|
||||
#define estrdup(x) chkstrdup(x)
|
||||
extern void* chkcalloc(size_t);
|
||||
extern void* chkrealloc(void*,size_t);
|
||||
extern void chkfree(void*);
|
||||
extern char* chkstrdup(const char* s);
|
||||
|
||||
#define MEMCHECK(var,throw) {if((var)==NULL) return (throw);}
|
||||
|
||||
#endif /*NCGEN_DEBUG_H*/
|
||||
|
@ -169,7 +169,7 @@ initcodify(void)
|
||||
idtlen = strlen("DIGIT_n_"); /* initial digit template */
|
||||
hexlen = strlen("_XHH"); /* template for hex of non-ASCII bytes */
|
||||
for(i = 0; i < 128; i++) {
|
||||
rp = emalloc(2);
|
||||
rp = ecalloc(2);
|
||||
rp[0] = i;
|
||||
rp[1] = '\0';
|
||||
repls[i] = rp;
|
||||
@ -180,7 +180,7 @@ initcodify(void)
|
||||
repls[j] = ctable[i].s;
|
||||
}
|
||||
for(i = 128; i < 256; i++) {
|
||||
rp = emalloc(hexlen+1);
|
||||
rp = ecalloc(hexlen+1);
|
||||
snprintf(rp, hexlen+1, "_X%2.2X", i); /* need to include null*/
|
||||
rp[hexlen] = '\0';
|
||||
repls[i] = rp;
|
||||
@ -460,7 +460,7 @@ f77quotestring(Bytebuffer* databuf)
|
||||
return;
|
||||
}
|
||||
|
||||
s = (unsigned char*)emalloc(slen+1);
|
||||
s = (unsigned char*)ecalloc(slen+1);
|
||||
memcpy((void*)s,bbContents(databuf),slen);
|
||||
s[slen] = '\0';
|
||||
bbClear(databuf);
|
||||
|
@ -383,6 +383,7 @@ genbin_defineattr(Symbol* asym)
|
||||
Bytebuffer* databuf = bbNew();
|
||||
generator_reset(bin_generator,NULL);
|
||||
generate_attrdata(asym,bin_generator,(Writer)genbin_write,databuf);
|
||||
bbFree(databuf);
|
||||
}
|
||||
|
||||
|
||||
@ -395,6 +396,7 @@ genbin_definevardata(Symbol* vsym)
|
||||
databuf = bbNew();
|
||||
generator_reset(bin_generator,NULL);
|
||||
generate_vardata(vsym,bin_generator,(Writer)genbin_write,databuf);
|
||||
bbFree(databuf);
|
||||
}
|
||||
|
||||
static int
|
||||
@ -457,7 +459,7 @@ static int
|
||||
genbin_writeattr(Generator* generator, Symbol* asym, Bytebuffer* databuf,
|
||||
int rank, size_t* start, size_t* count)
|
||||
{
|
||||
int stat;
|
||||
int stat = NC_NOERR;
|
||||
size_t len;
|
||||
Datalist* list;
|
||||
int varid, grpid, typid;
|
||||
|
@ -253,7 +253,7 @@ gen_leafchararray(Dimset* dimset, int dimindex, Datalist* data,
|
||||
}
|
||||
}
|
||||
if(cccount > 1) {
|
||||
char* accum = (char*)malloc(cccount+1);
|
||||
char* accum = (char*)ecalloc(cccount+1);
|
||||
int len = 0;
|
||||
Datalist* newlist = builddatalist(datalistlen(data));
|
||||
int lineno = 0;
|
||||
@ -338,13 +338,13 @@ gen_leafchararray(Dimset* dimset, int dimindex, Datalist* data,
|
||||
static NCConstant*
|
||||
makeconst(int lineno, int len, char* str)
|
||||
{
|
||||
NCConstant* con = (NCConstant*)malloc(sizeof(NCConstant));
|
||||
NCConstant* con = (NCConstant*)ecalloc(sizeof(NCConstant));
|
||||
con->nctype = NC_STRING;
|
||||
con->lineno = lineno;
|
||||
con->filled = 0;
|
||||
con->value.stringv.len = len;
|
||||
/* We cannot use strdup because str might have embedded nuls */
|
||||
con->value.stringv.stringv = (char*)malloc(len+1);
|
||||
con->value.stringv.stringv = (char*)ecalloc(len+1);
|
||||
memcpy((void*)con->value.stringv.stringv,(void*)str,len);
|
||||
con->value.stringv.stringv[len] = '\0';
|
||||
return con;
|
||||
|
@ -450,7 +450,7 @@ normalizeopaquelength(NCConstant* prim, unsigned long nbytes)
|
||||
prim->value.opaquev.len = nnibs;
|
||||
} else {/* prim->value.opaquev.len < nnibs => expand*/
|
||||
char* s;
|
||||
s = (char*)emalloc(nnibs+1);
|
||||
s = (char*)ecalloc(nnibs+1);
|
||||
memset(s,'0',nnibs); /* Fill with '0' characters */
|
||||
memcpy(s,prim->value.opaquev.stringv,prim->value.opaquev.len);
|
||||
s[nnibs] = '\0';
|
||||
|
@ -116,7 +116,7 @@ semerror(lno,fmt,va_alist) const int lno; const char* fmt; va_dcl
|
||||
vastart(argv,fmt);
|
||||
(void)fprintf(stderr,"%s: %s line %d: ", progname, cdlname, lno);
|
||||
vderror(fmt,argv);
|
||||
exit(1); /* immediately fatal */
|
||||
finalize_netcdf(1); /* immediately fatal */
|
||||
}
|
||||
|
||||
/* Capture potential version errors */
|
||||
|
@ -1541,7 +1541,7 @@ jname(Symbol* sym)
|
||||
/* Attribute name must be prefixed with the cname of the*/
|
||||
/* associated variable*/
|
||||
char* lname;
|
||||
lname = (char*)emalloc(strlen(sym->att.var->name)
|
||||
lname = (char*)ecalloc(strlen(sym->att.var->name)
|
||||
+strlen(sym->name)
|
||||
+1+1);
|
||||
lname[0] = '\0';
|
||||
|
@ -118,7 +118,7 @@ topfqn(Symbol* sym)
|
||||
parentfqn = parent->fqn;
|
||||
|
||||
fqnname = fqnescape(sym->name);
|
||||
fqn = (char*)malloc(strlen(fqnname) + strlen(parentfqn) + 1 + 1);
|
||||
fqn = (char*)ecalloc(strlen(fqnname) + strlen(parentfqn) + 1 + 1);
|
||||
strcpy(fqn,parentfqn);
|
||||
strcat(fqn,"/");
|
||||
strcat(fqn,fqnname);
|
||||
@ -153,7 +153,7 @@ nestedfqn(Symbol* sym)
|
||||
assert(parent->fqn != NULL);
|
||||
|
||||
fqnname = fqnescape(sym->name);
|
||||
fqn = (char*)malloc(strlen(fqnname) + strlen(parent->fqn) + 1 + 1);
|
||||
fqn = (char*)ecalloc(strlen(fqnname) + strlen(parent->fqn) + 1 + 1);
|
||||
strcpy(fqn,parent->fqn);
|
||||
strcat(fqn,".");
|
||||
strcat(fqn,fqnname);
|
||||
@ -185,7 +185,7 @@ attfqn(Symbol* sym)
|
||||
parentfqn = parent->fqn;
|
||||
|
||||
fqnname = fqnescape(sym->name);
|
||||
fqn = (char*)malloc(strlen(fqnname) + strlen(parentfqn) + 1 + 1);
|
||||
fqn = (char*)ecalloc(strlen(fqnname) + strlen(parentfqn) + 1 + 1);
|
||||
strcpy(fqn,parentfqn);
|
||||
strcat(fqn,"_");
|
||||
strcat(fqn,fqnname);
|
||||
|
@ -194,11 +194,11 @@ extern char *netcdf_name; /* command line -o file name */
|
||||
extern char *datasetname; /* name from the netcdf <name> {} */
|
||||
extern char *cdlname; /* name from the command line */
|
||||
|
||||
/* from: util.c */
|
||||
extern void* emalloc (size_t);
|
||||
extern void* ecalloc (size_t);
|
||||
extern void* erealloc(void*,size_t);
|
||||
|
||||
extern const char* specialname(int tag);
|
||||
|
||||
extern void init_netcdf(void);
|
||||
extern void finalize_netcdf(int);
|
||||
extern void parse_init(void);
|
||||
extern int ncgparse(void);
|
||||
|
||||
#endif /*!NC_GENLIB_H*/
|
||||
|
@ -446,7 +446,7 @@ jopaquestring(Symbol* tsym, Constant* prim, Constant* target)
|
||||
|
||||
ASSERT((oplen%2) == 0);
|
||||
|
||||
opstring = (char*)emalloc(oplen*(2+4));
|
||||
opstring = (char*)ecalloc(oplen*(2+4));
|
||||
opstring[0]='\0';
|
||||
|
||||
p=(unsigned char*)op;
|
||||
|
96
ncgen/main.c
96
ncgen/main.c
@ -22,13 +22,9 @@ int optind;
|
||||
/* Default is netcdf-3 mode 1 */
|
||||
#define DFALTCMODE 0
|
||||
|
||||
extern void init_netcdf(void);
|
||||
extern void parse_init(void);
|
||||
extern int ncgparse(void);
|
||||
|
||||
/* For error messages */
|
||||
char* progname;
|
||||
char* cdlname;
|
||||
char* progname; /* Global: not reclaimed */
|
||||
char* cdlname; /* Global: not reclaimed */
|
||||
|
||||
/* option flags */
|
||||
int nofill_flag;
|
||||
@ -64,6 +60,7 @@ extern FILE *ncgin;
|
||||
/* Forward */
|
||||
static char* ubasename(char*);
|
||||
void usage( void );
|
||||
|
||||
int main( int argc, char** argv );
|
||||
|
||||
/* Define tables vs modes for legal -k values*/
|
||||
@ -161,6 +158,19 @@ static char* LE16 = "\xFF\xFE"; /* UTF-16; little-endian */
|
||||
#define DFALTBINNCITERBUFFERSIZE 0x40000 /* about 250k bytes */
|
||||
#define DFALTLANGNCITERBUFFERSIZE 0x4000 /* about 15k bytes */
|
||||
|
||||
void *emalloc (size_t size) { /* check return from malloc */
|
||||
void *p;
|
||||
|
||||
if (size == 0)
|
||||
return 0;
|
||||
p = (void *) malloc (size);
|
||||
if (p == 0) {
|
||||
exit(NC_ENOMEM);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
/* strip off leading path */
|
||||
/* result is malloc'd */
|
||||
|
||||
@ -212,10 +222,10 @@ main(
|
||||
int argc,
|
||||
char *argv[])
|
||||
{
|
||||
int code = 0;
|
||||
int c;
|
||||
FILE *fp;
|
||||
struct Languages* langs;
|
||||
char* lang_name;
|
||||
#ifdef __hpux
|
||||
setlocale(LC_CTYPE,"");
|
||||
#endif
|
||||
@ -223,8 +233,8 @@ main(
|
||||
init_netcdf();
|
||||
|
||||
opterr = 1; /* print error message if bad option */
|
||||
progname = ubasename(argv[0]);
|
||||
cdlname = "-";
|
||||
progname = nulldup(ubasename(argv[0]));
|
||||
cdlname = NULL;
|
||||
netcdf_name = NULL;
|
||||
datasetname = NULL;
|
||||
l_flag = 0;
|
||||
@ -288,9 +298,10 @@ main(
|
||||
break;
|
||||
case 'H':
|
||||
usage();
|
||||
exit(0);
|
||||
goto done;
|
||||
case 'l': /* specify language, instead of using -c or -f or -b */
|
||||
{
|
||||
char* lang_name = NULL;
|
||||
if(l_flag != 0) {
|
||||
fprintf(stderr,"Please specify only one language\n");
|
||||
return 1;
|
||||
@ -299,18 +310,22 @@ main(
|
||||
derror("%s: output language is null", progname);
|
||||
return(1);
|
||||
}
|
||||
//lang_name = estrdup(optarg);
|
||||
lang_name = (char*) emalloc(strlen(optarg)+1);
|
||||
(void)strcpy(lang_name, optarg);
|
||||
for(langs=legallanguages;langs->name != NULL;langs++) {
|
||||
(void)strcpy(lang_name, optarg);
|
||||
|
||||
for(langs=legallanguages;langs->name != NULL;langs++) {
|
||||
if(strcmp(lang_name,langs->name)==0) {
|
||||
l_flag = langs->flag;
|
||||
l_flag = langs->flag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(langs->name == NULL) {
|
||||
derror("%s: output language %s not implemented",progname, lang_name);
|
||||
nullfree(lang_name);
|
||||
return(1);
|
||||
}
|
||||
nullfree(lang_name);
|
||||
}; break;
|
||||
case 'L':
|
||||
ncloglevel = atoi(optarg);
|
||||
@ -351,23 +366,18 @@ main(
|
||||
5 (=> classic 64 bit data aka CDF-5)
|
||||
*/
|
||||
struct Kvalues* kvalue;
|
||||
char *kind_name = (optarg != NULL
|
||||
? (char *) emalloc(strlen(optarg)+1)
|
||||
: emalloc(1));
|
||||
if (! kind_name) {
|
||||
derror ("%s: out of memory", progname);
|
||||
return(1);
|
||||
}
|
||||
if(optarg != NULL)
|
||||
(void)strcpy(kind_name, optarg);
|
||||
if(optarg == NULL) {
|
||||
derror("-k flag has no value");
|
||||
return 2;
|
||||
}
|
||||
for(kvalue=legalkinds;kvalue->name;kvalue++) {
|
||||
if(strcmp(kind_name,kvalue->name) == 0) {
|
||||
k_flag = kvalue->k_flag;
|
||||
break;
|
||||
}
|
||||
if(strcmp(optarg,kvalue->name) == 0) {
|
||||
k_flag = kvalue->k_flag;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(kvalue->name == NULL) {
|
||||
derror("Invalid format: %s",kind_name);
|
||||
derror("Invalid format: %s",optarg);
|
||||
return 2;
|
||||
}
|
||||
} break;
|
||||
@ -419,19 +429,19 @@ main(
|
||||
#ifndef ENABLE_C
|
||||
if(c_flag) {
|
||||
fprintf(stderr,"C not currently supported\n");
|
||||
exit(1);
|
||||
code=1; goto done;
|
||||
}
|
||||
#endif
|
||||
#ifndef ENABLE_BINARY
|
||||
if(l_flag == L_BINARY) {
|
||||
fprintf(stderr,"Binary netcdf not currently supported\n");
|
||||
exit(1);
|
||||
code=1; goto done;
|
||||
}
|
||||
#endif
|
||||
#ifndef ENABLE_JAVA
|
||||
if(l_flag == L_JAVA) {
|
||||
fprintf(stderr,"Java not currently supported\n");
|
||||
exit(1);
|
||||
code=1; goto done;
|
||||
}
|
||||
#else
|
||||
if(l_flag == L_JAVA && mainname != NULL && strcmp(mainname,"main")==0)
|
||||
@ -440,7 +450,7 @@ main(
|
||||
#ifndef ENABLE_F77
|
||||
if(l_flag == L_F77) {
|
||||
fprintf(stderr,"F77 not currently supported\n");
|
||||
exit(1);
|
||||
code=1; goto done;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -486,13 +496,12 @@ main(
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cdlname = (char*)emalloc(NC_MAX_NAME);
|
||||
cdlname = nulldup(argv[0]);
|
||||
if(cdlname != NULL) {
|
||||
if(strlen(cdlname) > NC_MAX_NAME)
|
||||
cdlname[NC_MAX_NAME] = '\0';
|
||||
}
|
||||
cdlname = nulldup(argv[0]);
|
||||
if(cdlname != NULL) {
|
||||
if(strlen(cdlname) > NC_MAX_NAME)
|
||||
cdlname[NC_MAX_NAME] = '\0';
|
||||
}
|
||||
|
||||
parse_init();
|
||||
@ -586,7 +595,9 @@ main(
|
||||
if(!syntax_only && error_count == 0)
|
||||
define_netcdf();
|
||||
|
||||
return 0;
|
||||
done:
|
||||
finalize_netcdf(code);
|
||||
return code;
|
||||
}
|
||||
|
||||
void
|
||||
@ -600,3 +611,10 @@ init_netcdf(void) /* initialize global counts, flags */
|
||||
stmt = bbNew();
|
||||
error_count = 0; /* Track # of errors */
|
||||
}
|
||||
|
||||
void
|
||||
finalize_netcdf(int retcode)
|
||||
{
|
||||
nc_finalize();
|
||||
exit(retcode);
|
||||
}
|
||||
|
@ -609,7 +609,7 @@ makepath(char* text0)
|
||||
/* split the text into IDENT chunks, convert to symbols */
|
||||
Symbol* container = rootgroup;
|
||||
char *ident, *p;
|
||||
char* text = strdup(text0);
|
||||
char* text = estrdup(text0);
|
||||
int c,lastident;
|
||||
ident=text+1; p=ident; /* skip leading '/' */
|
||||
do {
|
||||
|
@ -962,8 +962,7 @@ Symbol*
|
||||
install(const char *sname)
|
||||
{
|
||||
Symbol* sp;
|
||||
sp = (Symbol*) emalloc (sizeof (struct Symbol));
|
||||
memset((void*)sp,0,sizeof(struct Symbol));
|
||||
sp = (Symbol*) ecalloc (sizeof (struct Symbol));
|
||||
sp->name = nulldup(sname);
|
||||
sp->next = symlist;
|
||||
sp->lineno = lineno;
|
||||
@ -1051,7 +1050,7 @@ makeconstdata(nc_type nctype)
|
||||
char* s;
|
||||
int len;
|
||||
len = bbLength(lextext);
|
||||
s = (char*)emalloc(len+1);
|
||||
s = (char*)ecalloc(len+1);
|
||||
strncpy(s,bbContents(lextext),len);
|
||||
s[len] = '\0';
|
||||
con.value.opaquev.stringv = s;
|
||||
@ -1062,7 +1061,7 @@ makeconstdata(nc_type nctype)
|
||||
break; /* no associated value*/
|
||||
#endif
|
||||
|
||||
case NC_FILLVALUE:
|
||||
case NC_FILLVALUE:
|
||||
break; /* no associated value*/
|
||||
|
||||
default:
|
||||
@ -1250,7 +1249,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
||||
else if(tag == _SUPERBLOCK_FLAG)
|
||||
globalspecials._Superblock = idata;
|
||||
else if(tag == _NCPROPS_FLAG)
|
||||
globalspecials._NCProperties = strdup(sdata);
|
||||
globalspecials._NCProperties = estrdup(sdata);
|
||||
} else {
|
||||
Specialdata* special;
|
||||
/* Set up special info */
|
||||
@ -1317,7 +1316,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
||||
case _CHUNKSIZES_FLAG: {
|
||||
int i;
|
||||
special->nchunks = list->length;
|
||||
special->_ChunkSizes = (size_t*)emalloc(sizeof(size_t)*special->nchunks);
|
||||
special->_ChunkSizes = (size_t*)ecalloc(sizeof(size_t)*special->nchunks);
|
||||
for(i=0;i<special->nchunks;i++) {
|
||||
iconst.nctype = NC_INT;
|
||||
convert1(&list->data[i],&iconst);
|
||||
@ -1410,7 +1409,8 @@ containsfills(Datalist* list)
|
||||
for(i=0;i<list->length;i++,con++) {
|
||||
if(con->nctype == NC_COMPOUND) {
|
||||
if(containsfills(con->value.compoundv)) return 1;
|
||||
} else if(con->nctype == NC_FILLVALUE) return 1;
|
||||
} else if(con->nctype == NC_FILLVALUE)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -3420,7 +3420,7 @@ makepath(char* text0)
|
||||
/* split the text into IDENT chunks, convert to symbols */
|
||||
Symbol* container = rootgroup;
|
||||
char *ident, *p;
|
||||
char* text = strdup(text0);
|
||||
char* text = estrdup(text0);
|
||||
int c,lastident;
|
||||
ident=text+1; p=ident; /* skip leading '/' */
|
||||
do {
|
||||
|
@ -2984,8 +2984,7 @@ Symbol*
|
||||
install(const char *sname)
|
||||
{
|
||||
Symbol* sp;
|
||||
sp = (Symbol*) emalloc (sizeof (struct Symbol));
|
||||
memset((void*)sp,0,sizeof(struct Symbol));
|
||||
sp = (Symbol*) ecalloc (sizeof (struct Symbol));
|
||||
sp->name = nulldup(sname);
|
||||
sp->next = symlist;
|
||||
sp->lineno = lineno;
|
||||
@ -3073,7 +3072,7 @@ makeconstdata(nc_type nctype)
|
||||
char* s;
|
||||
int len;
|
||||
len = bbLength(lextext);
|
||||
s = (char*)emalloc(len+1);
|
||||
s = (char*)ecalloc(len+1);
|
||||
strncpy(s,bbContents(lextext),len);
|
||||
s[len] = '\0';
|
||||
con.value.opaquev.stringv = s;
|
||||
@ -3084,7 +3083,7 @@ makeconstdata(nc_type nctype)
|
||||
break; /* no associated value*/
|
||||
#endif
|
||||
|
||||
case NC_FILLVALUE:
|
||||
case NC_FILLVALUE:
|
||||
break; /* no associated value*/
|
||||
|
||||
default:
|
||||
@ -3272,7 +3271,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
||||
else if(tag == _SUPERBLOCK_FLAG)
|
||||
globalspecials._Superblock = idata;
|
||||
else if(tag == _NCPROPS_FLAG)
|
||||
globalspecials._NCProperties = strdup(sdata);
|
||||
globalspecials._NCProperties = estrdup(sdata);
|
||||
} else {
|
||||
Specialdata* special;
|
||||
/* Set up special info */
|
||||
@ -3339,7 +3338,7 @@ makespecial(int tag, Symbol* vsym, Symbol* tsym, void* data, int isconst)
|
||||
case _CHUNKSIZES_FLAG: {
|
||||
int i;
|
||||
special->nchunks = list->length;
|
||||
special->_ChunkSizes = (size_t*)emalloc(sizeof(size_t)*special->nchunks);
|
||||
special->_ChunkSizes = (size_t*)ecalloc(sizeof(size_t)*special->nchunks);
|
||||
for(i=0;i<special->nchunks;i++) {
|
||||
iconst.nctype = NC_INT;
|
||||
convert1(&list->data[i],&iconst);
|
||||
@ -3432,7 +3431,8 @@ containsfills(Datalist* list)
|
||||
for(i=0;i<list->length;i++,con++) {
|
||||
if(con->nctype == NC_COMPOUND) {
|
||||
if(containsfills(con->value.compoundv)) return 1;
|
||||
} else if(con->nctype == NC_FILLVALUE) return 1;
|
||||
} else if(con->nctype == NC_FILLVALUE)
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
@ -18,7 +18,7 @@ newodometer(Dimset* dimset, size_t* startp, size_t* countp)
|
||||
Odometer* odom;
|
||||
ASSERT(dimset != NULL);
|
||||
ASSERT(dimset->ndims > 0);
|
||||
odom = (Odometer*)emalloc(sizeof(Odometer));
|
||||
odom = (Odometer*)ecalloc(sizeof(Odometer));
|
||||
if(odom == NULL) return NULL;
|
||||
odom->origin = odom;
|
||||
odom->offset = 0;
|
||||
@ -44,7 +44,7 @@ newsubodometer(Odometer* origin, Dimset* dimset, int start, int stop)
|
||||
ASSERT(dimset != NULL);
|
||||
ASSERT(dimset->ndims > 0 && dimset->ndims >= stop);
|
||||
ASSERT(stop > start);
|
||||
odom = (Odometer*)emalloc(sizeof(Odometer));
|
||||
odom = (Odometer*)ecalloc(sizeof(Odometer));
|
||||
if(odom == NULL) return NULL;
|
||||
odom->origin = origin;
|
||||
odom->offset = start;
|
||||
|
@ -387,7 +387,9 @@ static void
|
||||
processenums(void)
|
||||
{
|
||||
unsigned long i,j;
|
||||
#if 0 /* Unused? */
|
||||
List* enumids = listnew();
|
||||
#endif
|
||||
for(i=0;i<listlength(typdefs);i++) {
|
||||
Symbol* sym = (Symbol*)listget(typdefs,i);
|
||||
ASSERT(sym->objectclass == NC_TYPE);
|
||||
@ -395,7 +397,9 @@ processenums(void)
|
||||
for(j=0;j<listlength(sym->subnodes);j++) {
|
||||
Symbol* esym = (Symbol*)listget(sym->subnodes,j);
|
||||
ASSERT(esym->subclass == NC_ECONST);
|
||||
#if 0 /* Unused? */
|
||||
listpush(enumids,(void*)esym);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
/* Convert enum values to match enum type*/
|
||||
@ -443,7 +447,7 @@ processeconstrefs(void)
|
||||
static void
|
||||
processeconstrefsR(Datalist* data)
|
||||
{
|
||||
NCConstant* con;
|
||||
NCConstant* con = NULL;
|
||||
int i;
|
||||
for(i=0,con=data->data;i<data->alloc;i++,con++) {
|
||||
if(con->nctype == NC_COMPOUND) {
|
||||
|
@ -13,7 +13,7 @@ char*
|
||||
append(const char* s1, const char* s2)
|
||||
{
|
||||
int len = (s1?strlen(s1):0)+(s2?strlen(s2):0);
|
||||
char* result = (char*)emalloc(len+1);
|
||||
char* result = (char*)ecalloc(len+1);
|
||||
result[0] = '\0';
|
||||
if(s1) strcat(result,s1);
|
||||
if(s2) strcat(result,s2);
|
||||
@ -461,7 +461,7 @@ poolalloc(size_t length)
|
||||
if(poolindex == POOLMAX) poolindex=0;
|
||||
if(length == 0) length = POOL_DEFAULT;
|
||||
if(pool[poolindex] != NULL) efree(pool[poolindex]);
|
||||
pool[poolindex] = (char*)emalloc(length);
|
||||
pool[poolindex] = (char*)ecalloc(length);
|
||||
return pool[poolindex++];
|
||||
}
|
||||
|
||||
@ -500,7 +500,7 @@ makebytestring(char* s, size_t* lenp)
|
||||
|
||||
ASSERT((slen%2) == 0);
|
||||
ASSERT(blen > 0);
|
||||
bytes = (unsigned char*)emalloc(blen);
|
||||
bytes = (unsigned char*)ecalloc(blen);
|
||||
b = bytes;
|
||||
for(i=0;i<slen;i+=2) {
|
||||
unsigned int digit1 = chartohex(*s++);
|
||||
@ -632,7 +632,7 @@ void check_err2(const int stat, const int cdlline, const int line, const char* f
|
||||
H5Eprint1(stderr);
|
||||
#endif
|
||||
fflush(stderr);
|
||||
exit(1);
|
||||
finalize_netcdf(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user