summaryrefslogtreecommitdiffstats
path: root/test/error_test.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2010-03-25 03:51:41 (GMT)
commit42efc1c2b591e4cd45ec6cb3bdf32044343118d2 (patch)
tree0ab542871c32246199479e8933ff26286aaf629a /test/error_test.c
parent3360c3af0c100ac4d3a2fe2865f34661da862ec5 (diff)
downloadhdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.zip
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.gz
hdf5-42efc1c2b591e4cd45ec6cb3bdf32044343118d2.tar.bz2
[svn-r18451] Description:
Bring r18172:18446 from trunk to revise_chunks branch. Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/default API=1.8.x, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (amani) w/Intel compilers, w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode
Diffstat (limited to 'test/error_test.c')
-rw-r--r--test/error_test.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/test/error_test.c b/test/error_test.c
index 89a81a3..e784eb9 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -186,11 +186,16 @@ test_error(hid_t file)
static herr_t
init_error(void)
{
- ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME)+1;
- char *cls_name = (char*)HDmalloc(HDstrlen(ERR_CLS_NAME)+1);
+ ssize_t cls_size = (ssize_t)HDstrlen(ERR_CLS_NAME) + 1;
ssize_t msg_size = (ssize_t)HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1;
- char *msg = (char*)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG)+1);
- H5E_type_t *msg_type= (H5E_type_t *)HDmalloc(sizeof(H5E_type_t));
+ char *cls_name = NULL;
+ char *msg = NULL;
+ H5E_type_t msg_type;
+
+ if(NULL == (cls_name = (char *)HDmalloc(HDstrlen(ERR_CLS_NAME) + 1)))
+ TEST_ERROR
+ if(NULL == (msg = (char *)HDmalloc(HDstrlen(ERR_MIN_SUBROUTINE_MSG) + 1)))
+ TEST_ERROR
if((ERR_CLS = H5Eregister_class(ERR_CLS_NAME, PROG_NAME, PROG_VERS)) < 0)
TEST_ERROR;
@@ -218,24 +223,28 @@ init_error(void)
if((ERR_MIN_GETNUM = H5Ecreate_msg(ERR_CLS, H5E_MINOR, ERR_MIN_GETNUM_MSG)) < 0)
TEST_ERROR;
- if(msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, msg_type, msg, (size_t)msg_size) + 1)
+ if(msg_size != H5Eget_msg(ERR_MIN_SUBROUTINE, &msg_type, msg, (size_t)msg_size) + 1)
TEST_ERROR;
- if(*msg_type != H5E_MINOR)
+ if(msg_type != H5E_MINOR)
TEST_ERROR;
if(HDstrcmp(msg, ERR_MIN_SUBROUTINE_MSG))
TEST_ERROR;
- HDfree(cls_name);
- HDfree(msg);
- HDfree(msg_type);
-
/* Register another class for later testing. */
if((ERR_CLS2 = H5Eregister_class(ERR_CLS2_NAME, PROG2_NAME, PROG_VERS)) < 0)
TEST_ERROR;
+ HDfree(cls_name);
+ HDfree(msg);
+
return 0;
error:
+ if(cls_name)
+ HDfree(cls_name);
+ if(msg)
+ HDfree(msg);
+
return -1;
} /* end init_error() */
@@ -586,7 +595,7 @@ main(void)
/* Delete an error from the top of error stack */
H5Epop(ERR_STACK, 1);
- /* Make sure we can use other class's major or minor errors. */
+ /* Make sure we can use other class's major or minor errors. */
H5Epush(ERR_STACK, __FILE__, FUNC_main, __LINE__, ERR_CLS2, ERR_MAJ_TEST, ERR_MIN_ERRSTACK,
"Error stack test failed");