diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-11-08 15:32:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-11-08 15:32:53 (GMT) |
commit | 0497e80b5017f0292a3232cfec4e268f9776d137 (patch) | |
tree | adf245ba8f035a20cb91e688a2529e439674634c /src/H5MMprivate.h | |
parent | dd969f1eadfd2cd500f3f44415b85cfea7216794 (diff) | |
download | hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.zip hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.tar.gz hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.tar.bz2 |
[svn-r7829] 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.h | 11 |
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); |