summaryrefslogtreecommitdiffstats
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
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
-rwxr-xr-xconfigure61
-rw-r--r--configure.in24
-rw-r--r--src/H5FP.c2
-rw-r--r--src/H5FPserver.c10
-rw-r--r--src/H5MM.c67
-rw-r--r--src/H5MMprivate.h11
-rw-r--r--src/H5config.h.in4
-rw-r--r--test/hyperslab.c109
-rw-r--r--test/istore.c25
-rw-r--r--test/tconfig.c42
10 files changed, 130 insertions, 225 deletions
diff --git a/configure b/configure
index 0552a22..7d59802 100755
--- a/configure
+++ b/configure
@@ -29898,67 +29898,6 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-echo "$as_me:$LINENO: checking if malloc of zero bytes returns valid pointer" >&5
-echo $ECHO_N "checking if malloc of zero bytes returns valid pointer... $ECHO_C" >&6
-if test "${hdf5_cv_malloc_works+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- if test "$cross_compiling" = yes; then
- { { echo "$as_me:$LINENO: error: cannot run test program while cross compiling" >&5
-echo "$as_me: error: cannot run test program while cross compiling" >&2;}
- { (exit 1); exit 1; }; }
-else
- cat >conftest.$ac_ext <<_ACEOF
-#line $LINENO "configure"
-#include "confdefs.h"
-
-#if STDC_HEADERS
-#include <stdlib.h>
-#endif
-
-int main(void)
-{
- exit(malloc (0) ? 0 : 1);
-}
-
-_ACEOF
-rm -f conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- hdf5_cv_malloc_works=yes
-else
- echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-cat conftest.$ac_ext >&5
-( exit $ac_status )
-hdf5_cv_malloc_works=no
-fi
-rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-fi
-
-
-if test ${hdf5_cv_malloc_works} = "yes"; then
-
-cat >>confdefs.h <<\_ACEOF
-#define MALLOC_WORKS 1
-_ACEOF
-
- echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6
-else
- echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6
-fi
-
echo "$as_me:$LINENO: checking Threads support system scope" >&5
echo $ECHO_N "checking Threads support system scope... $ECHO_C" >&6
if test "${hdf5_cv_system_scope_threads+set}" = set; then
diff --git a/configure.in b/configure.in
index 43439a1..ddfa4b5 100644
--- a/configure.in
+++ b/configure.in
@@ -1562,30 +1562,6 @@ AC_DEFINE_UNQUOTED(PRINTF_LL_WIDTH, "$hdf5_cv_printf_ll",
[Width for printf() for type \`long long' or \`__int64', use \`ll'])
dnl ----------------------------------------------------------------------
-dnl Check if malloc(0) returns valid pointer
-dnl
-AC_MSG_CHECKING([if malloc of zero bytes returns valid pointer])
-AC_CACHE_VAL(hdf5_cv_malloc_works,
-AC_TRY_RUN([
-#if STDC_HEADERS
-#include <stdlib.h>
-#endif
-
-int main(void)
-{
- exit(malloc (0) ? 0 : 1);
-}
-], hdf5_cv_malloc_works=yes, hdf5_cv_malloc_works=no,))
-
-if test ${hdf5_cv_malloc_works} = "yes"; then
- AC_DEFINE(MALLOC_WORKS, 1,
- [Define if your system's \`malloc' function returns a valid pointer for 0-byte allocations.])
- AC_MSG_RESULT(yes)
-else
- AC_MSG_RESULT(no)
-fi
-
-dnl ----------------------------------------------------------------------
dnl Check if pthread_attr_setscope(&attribute, PTHREAD_SCOPE_SYSTEM)
dnl is supported on this system
dnl
diff --git a/src/H5FP.c b/src/H5FP.c
index 60c73e3..5ca9a63 100644
--- a/src/H5FP.c
+++ b/src/H5FP.c
@@ -291,7 +291,7 @@ H5FP_read_metadata(char **mdata, int len, int from)
* There is metadata associated with this request. Get it as a
* string (requires another read).
*/
- if ((*mdata = (char *)HDmalloc((size_t)len + 1)) == NULL)
+ if ((*mdata = (char *)H5MM_malloc((size_t)len + 1)) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "out of memory");
HDmemset(*mdata, 0, (size_t)len + 1);
diff --git a/src/H5FPserver.c b/src/H5FPserver.c
index 98c21c3..1e980c3 100644
--- a/src/H5FPserver.c
+++ b/src/H5FPserver.c
@@ -333,7 +333,7 @@ H5FP_new_object_lock(const unsigned char *oid, unsigned rank,
FUNC_ENTER_NOINIT(H5FP_new_object_lock);
assert(oid);
- if ((ret_value = (H5FP_object_lock *)HDmalloc(sizeof(H5FP_object_lock))) == NULL)
+ if ((ret_value = (H5FP_object_lock *)H5MM_malloc(sizeof(H5FP_object_lock))) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory");
H5FP_COPY_OID(ret_value->oid, oid);
@@ -478,7 +478,7 @@ H5FP_new_file_mod_node(unsigned UNUSED rank, H5FD_mem_t mem_type,
FUNC_ENTER_NOINIT(H5FP_new_file_mod_node);
- if ((ret_value = (H5FP_mdata_mod *)HDmalloc(sizeof(H5FP_mdata_mod))) == NULL)
+ if ((ret_value = (H5FP_mdata_mod *)H5MM_malloc(sizeof(H5FP_mdata_mod))) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory");
ret_value->mem_type = mem_type;
@@ -597,7 +597,7 @@ H5FP_new_file_info_node(unsigned file_id)
FUNC_ENTER_NOINIT(H5FP_new_file_info_node);
- if ((ret_value = (H5FP_file_info *)HDmalloc(sizeof(H5FP_file_info))) == NULL)
+ if ((ret_value = (H5FP_file_info *)H5MM_malloc(sizeof(H5FP_file_info))) == NULL)
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "out of memory");
ret_value->file_id = file_id;
@@ -938,7 +938,7 @@ H5FP_sap_handle_lock_request(H5FP_request_t *req)
FUNC_ENTER_NOINIT(H5FP_sap_handle_lock_request);
- if ((oids = (struct lock_group *)HDmalloc(list_size *
+ if ((oids = (struct lock_group *)H5MM_malloc(list_size *
sizeof(struct lock_group))) == NULL) {
exit_state = H5FP_STATUS_OOM;
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "out of memory");
@@ -1141,7 +1141,7 @@ H5FP_sap_handle_release_lock_request(H5FP_request_t *req)
FUNC_ENTER_NOINIT(H5FP_sap_handle_release_lock_request);
- if ((oids = (struct release_group *)HDmalloc(list_size *
+ if ((oids = (struct release_group *)H5MM_malloc(list_size *
sizeof(struct release_group))) == NULL) {
exit_state = H5FP_STATUS_OOM;
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "out of memory");
diff --git a/src/H5MM.c b/src/H5MM.c
index 371f292..9701bb9 100644
--- a/src/H5MM.c
+++ b/src/H5MM.c
@@ -33,6 +33,73 @@
static int interface_initialize_g = 0;
#define INTERFACE_INIT NULL
+#ifndef NDEBUG
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_malloc
+ *
+ * Purpose: Just like the POSIX version of malloc(3). This routine
+ * specifically checks for allocations of 0 bytes and fails
+ * in that case. This routine is not called when NDEBUG is
+ * defined.
+ *
+ * Return: Success: Ptr to new memory
+ *
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Nov 8 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5MM_malloc(size_t size)
+{
+ /* Use FUNC_ENTER_NOINIT here to avoid performance issues */
+ FUNC_ENTER_NOINIT(H5MM_malloc);
+
+ assert(size);
+
+ FUNC_LEAVE_NOAPI(HDmalloc(size));
+} /* end H5MM_malloc() */
+
+
+/*-------------------------------------------------------------------------
+ * Function: H5MM_calloc
+ *
+ * Purpose: Similar to the POSIX version of calloc(3), except this routine
+ * just takes a 'size' parameter. This routine
+ * specifically checks for allocations of 0 bytes and fails
+ * in that case. This routine is not called when NDEBUG is
+ * defined.
+ *
+ * Return: Success: Ptr to new memory
+ *
+ * Failure: NULL
+ *
+ * Programmer: Quincey Koziol
+ * koziol@ncsa.uiuc.edu
+ * Nov 8 2003
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+void *
+H5MM_calloc(size_t size)
+{
+ /* Use FUNC_ENTER_NOINIT here to avoid performance issues */
+ FUNC_ENTER_NOINIT(H5MM_calloc);
+
+ assert(size);
+
+ FUNC_LEAVE_NOAPI(HDcalloc(1,size));
+} /* end H5MM_calloc() */
+#endif /* NDEBUG */
+
/*-------------------------------------------------------------------------
* Function: H5MM_realloc
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);
diff --git a/src/H5config.h.in b/src/H5config.h.in
index 6e8e6d0..11c8e7b 100644
--- a/src/H5config.h.in
+++ b/src/H5config.h.in
@@ -340,10 +340,6 @@
/* Define if `__tm_gmtoff' is a member of `struct tm' */
#undef HAVE___TM_GMTOFF
-/* Define if your system's `malloc' function returns a valid pointer for
- 0-byte allocations. */
-#undef MALLOC_WORKS
-
/* Define if your system's `MPI_File_set_size' function works for files over
2GB. */
#undef MPI_FILE_SET_SIZE_BIG
diff --git a/test/hyperslab.c b/test/hyperslab.c
index 70ee3a5..556d2f0 100644
--- a/test/hyperslab.c
+++ b/test/hyperslab.c
@@ -24,7 +24,6 @@
#include "h5test.h"
#include "H5private.h"
#include "H5Eprivate.h"
-#include "H5MMprivate.h"
#include "H5Vprivate.h"
#define TEST_SMALL 0x0001
@@ -130,7 +129,7 @@ print_ref(size_t nx, size_t ny, size_t nz)
{
uint8_t *array;
- array = H5MM_calloc(nx*ny*nz*sizeof(uint8_t));
+ array = HDcalloc(nx*ny*nz,sizeof(uint8_t));
printf("Reference array:\n");
init_full(array, nx, ny, nz);
@@ -193,7 +192,7 @@ test_fill(size_t nx, size_t ny, size_t nz,
fflush(stdout);
/* Allocate array */
- dst = H5MM_calloc(nx*ny*nz);
+ dst = HDcalloc(1,nx*ny*nz);
init_full(dst, nx, ny, nz);
for (i = 0; i < nx; i += di) {
@@ -287,11 +286,11 @@ test_fill(size_t nx, size_t ny, size_t nz,
}
}
puts(" PASSED");
- H5MM_xfree(dst);
+ HDfree(dst);
return SUCCEED;
error:
- H5MM_xfree(dst);
+ HDfree(dst);
return FAIL;
}
@@ -397,8 +396,8 @@ test_copy(int mode,
/*
* Allocate arrays
*/
- src = H5MM_calloc(nx*ny*nz);
- dst = H5MM_calloc(nx*ny*nz);
+ src = HDcalloc(1,nx*ny*nz);
+ dst = HDcalloc(1,nx*ny*nz);
init_full(src, nx, ny, nz);
for (i=0; i<nx; i+=di) {
@@ -574,18 +573,13 @@ test_copy(int mode,
}
}
puts(" PASSED");
-#if defined(WIN32) && defined(_HDF5USEDLL_)
HDfree(src);
HDfree(dst);
-#else
- H5MM_xfree(src);
- H5MM_xfree(dst);
-#endif
return SUCCEED;
error:
- H5MM_xfree(src);
- H5MM_xfree(dst);
+ HDfree(src);
+ HDfree(dst);
return FAIL;
}
@@ -628,15 +622,8 @@ test_multifill(size_t nx)
fflush(stdout);
/* Initialize the source and destination */
-#if !defined(WIN32) && !defined(_HDF5USEDLL_)
- src = H5MM_malloc(nx * sizeof(*src));
- dst = H5MM_malloc(nx * sizeof(*dst));
-#else
-/*
- to match the HDfree I plan on using to free this memory */
- src = malloc(nx * sizeof(*src));
- dst = malloc(nx * sizeof(*dst));
-#endif
+ src = HDmalloc(nx * sizeof(*src));
+ dst = HDmalloc(nx * sizeof(*dst));
for (i = 0; i < nx; i++) {
src[i].left = 1111111;
src[i].mid = 12345.6789;
@@ -701,21 +688,13 @@ test_multifill(size_t nx)
}
puts(" PASSED");
-#if !defined(WIN32) && !defined(_HDF5USEDLL_)
- H5MM_xfree(src);
- H5MM_xfree(dst);
-#else
-/*
- The above calls to H5MM_xfree crash on NT but using free does not.
-*/
- HDfree(src);
- HDfree(dst);
-#endif
+ HDfree(src);
+ HDfree(dst);
return SUCCEED;
error:
- H5MM_xfree(src);
- H5MM_xfree(dst);
+ HDfree(src);
+ HDfree(dst);
return FAIL;
}
@@ -751,9 +730,9 @@ test_endian(size_t nx)
fflush(stdout);
/* Initialize arrays */
- src = H5MM_malloc(nx * 4);
+ src = HDmalloc(nx * 4);
init_full(src, nx, 4, 1);
- dst = H5MM_calloc(nx * 4);
+ dst = HDcalloc(nx , 4);
/* Initialize strides */
src_stride[0] = 0;
@@ -790,18 +769,13 @@ test_endian(size_t nx)
}
puts(" PASSED");
-#if defined(WIN32) && defined(_HDF5USEDLL_)
- HDfree(src);
- HDfree(dst);
-#else
- H5MM_xfree(src);
- H5MM_xfree(dst);
-#endif
+ HDfree(src);
+ HDfree(dst);
return SUCCEED;
error:
- H5MM_xfree(src);
- H5MM_xfree(dst);
+ HDfree(src);
+ HDfree(dst);
return FAIL;
}
@@ -838,13 +812,13 @@ test_transpose(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- src = H5MM_malloc(nx * ny * sizeof(*src));
+ src = HDmalloc(nx * ny * sizeof(*src));
for (i = 0; i < nx; i++) {
for (j = 0; j < ny; j++) {
src[i * ny + j] = (int)(i * ny + j);
}
}
- dst = H5MM_calloc(nx*ny*sizeof(*dst));
+ dst = HDcalloc(nx*ny,sizeof(*dst));
/* Build stride info */
size[0] = nx;
@@ -897,18 +871,13 @@ test_transpose(size_t nx, size_t ny)
}
puts(" PASSED");
-#if !defined(WIN32) && !defined(_HDF5USEDLL_)
- H5MM_xfree(src);
- H5MM_xfree(dst);
-#else
HDfree(src);
HDfree(dst);
-#endif
return SUCCEED;
error:
- H5MM_xfree(src);
- H5MM_xfree(dst);
+ HDfree(src);
+ HDfree(dst);
return FAIL;
}
@@ -950,10 +919,10 @@ test_sub_super(size_t nx, size_t ny)
fflush(stdout);
/* Initialize */
- full = H5MM_malloc(4 * nx * ny);
+ full = HDmalloc(4 * nx * ny);
init_full(full, 2 * nx, 2 * ny, 1);
- half = H5MM_calloc(nx*ny);
- twice = H5MM_calloc(4*nx*ny);
+ half = HDcalloc(1,nx*ny);
+ twice = HDcalloc(4,nx*ny);
/* Setup */
size[0] = nx;
@@ -1062,15 +1031,15 @@ test_sub_super(size_t nx, size_t ny)
}
puts(" PASSED");
- H5MM_xfree(full);
- H5MM_xfree(half);
- H5MM_xfree(twice);
+ HDfree(full);
+ HDfree(half);
+ HDfree(twice);
return SUCCEED;
error:
- H5MM_xfree(full);
- H5MM_xfree(half);
- H5MM_xfree(twice);
+ HDfree(full);
+ HDfree(half);
+ HDfree(twice);
return FAIL;
}
@@ -1104,7 +1073,7 @@ test_array_fill(size_t lo, size_t hi)
TESTING(s);
/* Initialize */
- dst = H5MM_calloc(sizeof(int)*ARRAY_FILL_SIZE * hi);
+ dst = HDcalloc(sizeof(int),ARRAY_FILL_SIZE * hi);
/* Setup */
for(u=0; u<ARRAY_FILL_SIZE; u++)
@@ -1123,11 +1092,11 @@ test_array_fill(size_t lo, size_t hi)
} /* end for */
PASSED();
- H5MM_xfree(dst);
+ HDfree(dst);
return SUCCEED;
error:
- H5MM_xfree(dst);
+ HDfree(dst);
return FAIL;
}
@@ -1164,7 +1133,7 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
TESTING(s);
/* Initialize */
- a = H5MM_malloc(sizeof(hsize_t) * x * y *z);
+ a = HDmalloc(sizeof(hsize_t) * x * y *z);
dims[0]=z;
dims[1]=y;
dims[2]=x;
@@ -1201,11 +1170,11 @@ test_array_offset_n_calc(size_t n, size_t x, size_t y, size_t z)
PASSED();
- H5MM_xfree(a);
+ HDfree(a);
return SUCCEED;
error:
- H5MM_xfree(a);
+ HDfree(a);
return FAIL;
}
diff --git a/test/istore.c b/test/istore.c
index b1c2453..7de1d90 100644
--- a/test/istore.c
+++ b/test/istore.c
@@ -28,7 +28,6 @@
#include "H5Pprivate.h"
#include "H5Fpkg.h"
#include "H5Gprivate.h"
-#include "H5MMprivate.h"
#include "H5Oprivate.h"
#include "H5Pprivate.h"
#include "H5Vprivate.h"
@@ -253,9 +252,9 @@ test_extend(hid_t f, const char *prefix,
sprintf(s, "istore extend: %s", dims);
TESTING(s);
- buf = H5MM_malloc(nx * ny * nz);
- check = H5MM_malloc(nx * ny * nz);
- whole = H5MM_calloc(nx*ny*nz);
+ buf = HDmalloc(nx * ny * nz);
+ check = HDmalloc(nx * ny * nz);
+ whole = HDcalloc(1,nx*ny*nz);
whole_size[0] = nx;
whole_size[1] = ny;
@@ -401,17 +400,17 @@ test_extend(hid_t f, const char *prefix,
if(H5Dclose(dataset)<0) TEST_ERROR;
/* Free memory used */
- H5MM_xfree(buf);
- H5MM_xfree(check);
- H5MM_xfree(whole);
+ HDfree(buf);
+ HDfree(check);
+ HDfree(whole);
PASSED();
return SUCCEED;
error:
- H5MM_xfree(buf);
- H5MM_xfree(check);
- H5MM_xfree(whole);
+ HDfree(buf);
+ HDfree(check);
+ HDfree(whole);
return FAIL;
}
@@ -467,7 +466,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
sprintf(s, "istore sparse: %s", dims);
TESTING(s);
- buf = H5MM_malloc(nx * ny * nz);
+ buf = HDmalloc(nx * ny * nz);
HDmemset(buf, 128, nx * ny * nz);
/* Set dimensions of dataset */
@@ -534,12 +533,12 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks,
/* Close dataset */
if(H5Dclose(dataset)<0) TEST_ERROR;
- H5MM_xfree(buf);
+ HDfree(buf);
PASSED();
return SUCCEED;
error:
- H5MM_xfree(buf);
+ HDfree(buf);
return FAIL;
}
diff --git a/test/tconfig.c b/test/tconfig.c
index 73197653..4cb3976 100644
--- a/test/tconfig.c
+++ b/test/tconfig.c
@@ -36,7 +36,6 @@
/* local routine prototypes */
void test_config_ctypes(void);
-void test_config_malloc(void);
/*-------------------------------------------------------------------------
@@ -59,7 +58,6 @@ test_configure(void)
/* Output message about test being performed */
MESSAGE(5, ("Testing configure definitions\n"));
test_config_ctypes();
- test_config_malloc();
}
@@ -184,43 +182,3 @@ test_config_ctypes(void)
#endif
}
-
-
-/*-------------------------------------------------------------------------
- * Function: test_config_malloc
- *
- * Purpose: test C language malloc function
- *
- * Return: none (error is fed back via global variable num_errs)
- *
- * Programmer: Albert Cheng
- * April 13, 2002
- *
- * Modifications:
- *
- *-------------------------------------------------------------------------
- */
-void
-test_config_malloc(void)
-{
- char *pt;
-
- /* verify H5_MALLOC_WORKS (malloc zero byte) macros */
- pt = malloc(0);
-
-#ifdef H5_MALLOC_WORKS
- if (pt==NULL){
- print_func("Error verifying H5_MALLOC_WORKS: "
- "expected non-NULL, got NULL\n");
- num_errs++;
- }
-
- free(pt);
-#else
- if (pt!=NULL){
- print_func("Error verifying H5_MALLOC_WORKS: "
- "expected NULL, got non-NULL\n");
- num_errs++;
- }
-#endif
-}