diff options
author | Sean McBride <sean@rogue-research.com> | 2021-03-22 17:51:18 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-22 17:51:18 (GMT) |
commit | 38b9474af03909d49cc928c71c190e4f26a15b5c (patch) | |
tree | b8eb735f44b4e246816a4daec9714d5c4d89675e /c++/test/dsets.cpp | |
parent | 60e14b826a22452934f7057196c1ce4d0054d97a (diff) | |
download | hdf5-38b9474af03909d49cc928c71c190e4f26a15b5c.zip hdf5-38b9474af03909d49cc928c71c190e4f26a15b5c.tar.gz hdf5-38b9474af03909d49cc928c71c190e4f26a15b5c.tar.bz2 |
Applied clang-tidy readability-delete-null-pointer fixes (#430)
delete nullptr is well-defined, does not need check.
Manually fixed indentation after automatic changes.
Diffstat (limited to 'c++/test/dsets.cpp')
-rw-r--r-- | c++/test/dsets.cpp | 36 |
1 files changed, 12 insertions, 24 deletions
diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 0faf457..356112e 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -159,8 +159,7 @@ test_create(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (dataset != NULL) - delete dataset; + delete dataset; return -1; } // catch all other exceptions @@ -168,8 +167,7 @@ test_create(H5File &file) issue_fail_msg("test_create", __LINE__, __FILE__); // clean up and return with failure - if (dataset != NULL) - delete dataset; + delete dataset; return -1; } } // test_create @@ -249,8 +247,7 @@ test_simple_io(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (tconv_buf) - delete[] tconv_buf; + delete[] tconv_buf; return -1; } } // test_simple_io @@ -692,10 +689,8 @@ test_compression(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (dataset != NULL) - delete dataset; - if (tconv_buf) - delete[] tconv_buf; + delete dataset; + delete[] tconv_buf; return -1; } } // test_compression @@ -885,8 +880,7 @@ test_multiopen(H5File &file) cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; // clean up and return with failure - if (space != NULL) - delete space; + delete space; return -1; } } // test_multiopen @@ -964,8 +958,7 @@ test_types(H5File &file) cerr << " <<< " << "bitfield_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; + delete dset; return -1; } @@ -996,8 +989,7 @@ test_types(H5File &file) cerr << " <<< " << "bitfield_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; + delete dset; throw E; // propagate the exception } @@ -1031,10 +1023,8 @@ test_types(H5File &file) cerr << " <<< " << "opaque_1: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - if (optype != NULL) - delete optype; + delete dset; + delete optype; throw E; // propagate the exception } @@ -1067,10 +1057,8 @@ test_types(H5File &file) cerr << " <<< " << "opaque_2: " << E.getFuncName() << " - " << E.getDetailMsg() << " >>>" << endl << endl; - if (dset != NULL) - delete dset; - if (optype != NULL) - delete optype; + delete dset; + delete optype; throw E; // propagate the exception } |