diff options
author | Dana Robinson <43805+derobins@users.noreply.github.com> | 2024-03-10 19:42:16 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-10 19:42:16 (GMT) |
commit | f0ba8baa0d21197df828f3054840755a45105ac0 (patch) | |
tree | 2e9e98644e95f2be61208a3fb72171a10ad7dabf /tools | |
parent | ef401a5f5edf2fc689334a485a6c2ec3f53ecb85 (diff) | |
download | hdf5-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.c | 21 |
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; } |