summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2024-03-10 19:42:16 (GMT)
committerGitHub <noreply@github.com>2024-03-10 19:42:16 (GMT)
commitf0ba8baa0d21197df828f3054840755a45105ac0 (patch)
tree2e9e98644e95f2be61208a3fb72171a10ad7dabf /tools
parentef401a5f5edf2fc689334a485a6c2ec3f53ecb85 (diff)
downloadhdf5-f0ba8baa0d21197df828f3054840755a45105ac0.zip
hdf5-f0ba8baa0d21197df828f3054840755a45105ac0.tar.gz
hdf5-f0ba8baa0d21197df828f3054840755a45105ac0.tar.bz2
Minimize use of abort() (#4110)
The abort() call is used at several places where it probably shouldn't.
Diffstat (limited to 'tools')
-rw-r--r--tools/test/misc/talign.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/test/misc/talign.c b/tools/test/misc/talign.c
index 7de9d1a..e3c0f45 100644
--- a/tools/test/misc/talign.c
+++ b/tools/test/misc/talign.c
@@ -48,8 +48,8 @@ main(void)
char *data = NULL;
- int result = 0;
- herr_t error = 1;
+ int result = EXIT_SUCCESS;
+ herr_t error = FAIL;
printf("%-70s", "Testing alignment in compound datatypes");
@@ -59,7 +59,7 @@ main(void)
if (fil < 0) {
puts("*FAILED*");
- return 1;
+ return EXIT_FAILURE;
}
H5E_BEGIN_TRY
@@ -123,10 +123,9 @@ main(void)
/* Now open the set, and read it back in */
data = (char *)malloc(H5Tget_size(fix));
-
if (!data) {
- perror("malloc() failed");
- HDabort();
+ puts("*FAILED*");
+ return EXIT_FAILURE;
}
set = H5Dopen2(fil, setname, H5P_DEFAULT);
@@ -137,14 +136,14 @@ main(void)
out:
if (error < 0) {
- result = 1;
+ result = EXIT_FAILURE;
puts("*FAILED - HDF5 library error*");
}
else if (!(H5_FLT_ABS_EQUAL(fok[0], fptr[0])) || !(H5_FLT_ABS_EQUAL(fok[1], fptr[1])) ||
!(H5_FLT_ABS_EQUAL(fnok[0], fptr[2])) || !(H5_FLT_ABS_EQUAL(fnok[1], fptr[3]))) {
char *mname;
- result = 1;
+ result = EXIT_FAILURE;
mname = H5Tget_member_name(fix, 0);
printf("%14s (%2d) %6s = %s\n", mname ? mname : "(null)", (int)H5Tget_member_offset(fix, 0), string5,
(char *)(data + H5Tget_member_offset(fix, 0)));
@@ -185,8 +184,8 @@ out:
puts(" PASSED");
}
- if (data)
- free(data);
+ free(data);
+
H5Sclose(spc);
H5Tclose(cs6);
H5Tclose(cmp);
@@ -196,7 +195,9 @@ out:
H5Tclose(cmp3);
H5Pclose(plist);
H5Fclose(fil);
+
HDunlink(fname);
fflush(stdout);
+
return result;
}