summaryrefslogtreecommitdiffstats
path: root/src/H5MMprivate.h
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2003-11-08 15:33:13 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2003-11-08 15:33:13 (GMT)
commita89dda8cb1260f05f3e283ca80310b3090940341 (patch)
treef795625c9dd894d518b75a810c4d73a39f089f87 /src/H5MMprivate.h
parent677f6cc3d8d7000c19869f7c09e9a015606369b8 (diff)
downloadhdf5-a89dda8cb1260f05f3e283ca80310b3090940341.zip
hdf5-a89dda8cb1260f05f3e283ca80310b3090940341.tar.gz
hdf5-a89dda8cb1260f05f3e283ca80310b3090940341.tar.bz2
[svn-r7830] Purpose:
Bug fix & code cleanup Description: Allowing the library to call malloc with a size of 0 bytes causes problems for some users, so we check for allocations of 0 bytes and disallow them now. Cleaned up some code which could call malloc with 0 size. Changed some code calling HDmalloc directly to call H5MM_malloc(), which allows us to check for 0 sized allocations. Platforms tested: FreeBSD 4.9 (sleipnir) too minor to require h5committest
Diffstat (limited to 'src/H5MMprivate.h')
-rw-r--r--src/H5MMprivate.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h
index 54dfbfb..9aadd36 100644
--- a/src/H5MMprivate.h
+++ b/src/H5MMprivate.h
@@ -32,18 +32,19 @@
/* Private headers needed by this file */
#include "H5private.h"
-#ifdef H5_MALLOC_WORKS
+#ifdef NDEBUG
#define H5MM_malloc(Z) HDmalloc(Z)
#define H5MM_calloc(Z) HDcalloc(1,Z)
-#else /* H5_MALLOC_WORKS */
-#define H5MM_malloc(Z) HDmalloc(MAX(1,Z))
-#define H5MM_calloc(Z) HDcalloc(1,MAX(1,Z))
-#endif /* H5_MALLOC_WORKS */
+#endif /* NDEBUG */
#define H5MM_free(Z) HDfree(Z)
/*
* Library prototypes...
*/
+#ifndef NDEBUG
+H5_DLL void *H5MM_malloc(size_t size);
+H5_DLL void *H5MM_calloc(size_t size);
+#endif /* NDEBUG */
H5_DLL void *H5MM_realloc(void *mem, size_t size);
H5_DLL char *H5MM_xstrdup(const char *s);
H5_DLL char *H5MM_strdup(const char *s);