From d5cb4b9e3edd92a2d361cc00bb3480357b23c6c8 Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Tue, 22 Mar 2016 07:29:00 -0600 Subject: [PATCH] Add hashmap for quick retrieval of dim and var --- include/Makefile.am | 2 +- libsrc/Makefile.am | 2 +- libsrc/var.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/include/Makefile.am b/include/Makefile.am index f4fb08e66..aebb8e483 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -18,7 +18,7 @@ noinst_HEADERS = nc_logging.h nc_tests.h fbits.h nc.h \ nclist.h ncuri.h utf8proc.h ncdispatch.h ncdimscale.h \ netcdf_f.h err_macros.h ncbytes.h nchashmap.h ceconstraints.h rnd.h \ nclog.h ncconfigure.h nc4internal.h nctime.h nc3dispatch.h nc3internal.h \ -onstack.h +onstack.h nc_hashmap.h if USE_NETCDF4 noinst_HEADERS += ncaux.h diff --git a/libsrc/Makefile.am b/libsrc/Makefile.am index 87263abb2..f84c3ef08 100644 --- a/libsrc/Makefile.am +++ b/libsrc/Makefile.am @@ -15,7 +15,7 @@ endif # BUILD_DLL # 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 \ +putget.c attr.c nc3dispatch.c nc3internal.c var.c dim.c ncx.c nc_hashmap.c \ ncx.h lookup3.c pstdint.h ncio.c ncio.h if BUILD_DISKLESS diff --git a/libsrc/var.c b/libsrc/var.c index 65670a050..75e6e5577 100644 --- a/libsrc/var.c +++ b/libsrc/var.c @@ -287,11 +287,11 @@ incr_NC_vararray(NC_vararray *ncap, NC_var *newelemp) else if(ncap->nelems +1 > ncap->nalloc) { vp = (NC_var **) realloc(ncap->value, - (ncap->nalloc + NC_ARRAY_GROWBY) * sizeof(NC_var *)); + (ncap->nalloc * NC_ARRAY_MULT) * sizeof(NC_var *)); if(vp == NULL) return NC_ENOMEM; ncap->value = vp; - ncap->nalloc += NC_ARRAY_GROWBY; + ncap->nalloc *= NC_ARRAY_MULT; } if(newelemp != NULL)