From 25ee8b4e8f00329d2337cf562ee5125c33e322e9 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Wed, 6 Sep 2000 10:34:30 -0500 Subject: [svn-r2509] Change code so that heap_size wasn't zero. --- src/H5P.c | 6 ++---- src/H5Ppublic.h | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/H5P.c b/src/H5P.c index 1e985d6..c60ad6c 100644 --- a/src/H5P.c +++ b/src/H5P.c @@ -3385,9 +3385,7 @@ H5P_create_class(H5P_genclass_t *par_class, const char *name, uintn hashsize, ui } /* Allocate room for the class & it's hash table of properties */ - /* Need to (intn) hashsize so that (hashsize-1) can be negative since hashsize can be 0. */ - if (NULL==(pclass = H5MM_calloc (sizeof(H5P_genclass_t)+ - ((((intn)hashsize)-1)*sizeof(H5P_genprop_t *))))) + if (NULL==(pclass = H5MM_calloc (sizeof(H5P_genclass_t)+((hashsize-1)*sizeof(H5P_genprop_t *))))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,"memory allocation failed"); /* Set class state */ @@ -3542,7 +3540,7 @@ H5P_genplist_t *H5P_create_list(H5P_genclass_t *class) */ /* Allocate room for the property list & it's hash table of properties */ - if (NULL==(plist = H5MM_calloc (sizeof(H5P_genplist_t)+(((intn)(class->hashsize)-1)*sizeof(H5P_genprop_t *))))) + if (NULL==(plist = H5MM_calloc (sizeof(H5P_genplist_t)+((class->hashsize-1)*sizeof(H5P_genprop_t *))))) HGOTO_ERROR (H5E_RESOURCE, H5E_NOSPACE, NULL,"memory allocation failed"); /* Set class state */ diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h index 0ae36aa..bf5b3f6 100644 --- a/src/H5Ppublic.h +++ b/src/H5Ppublic.h @@ -61,7 +61,7 @@ extern "C" { * The library created property list classes */ #define H5P_NO_CLASS_NEW (H5open(), H5P_NO_CLASS_g) -#define H5P_NO_CLASS_HASH_SIZE 0 +#define H5P_NO_CLASS_HASH_SIZE 1 /* 1, not 0, otherwise allocations get weird */ #define H5P_FILE_CREATE_NEW (H5open(), H5P_FILE_CREATE_g) #define H5P_FILE_CREATE_HASH_SIZE 17 #define H5P_FILE_ACCESS_NEW (H5open(), H5P_FILE_ACCESS_g) -- cgit v0.12