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++ | |
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++')
-rw-r--r-- | c++/src/H5DaccProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5DataSpace.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5DcreatProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5DxferProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5FaccProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5FcreatProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5LaccProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5LcreatProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5OcreatProp.cpp | 3 | ||||
-rw-r--r-- | c++/src/H5PropList.cpp | 3 | ||||
-rw-r--r-- | c++/test/dsets.cpp | 36 | ||||
-rw-r--r-- | c++/test/tcompound.cpp | 12 | ||||
-rw-r--r-- | c++/test/tfile.cpp | 12 | ||||
-rw-r--r-- | c++/test/trefer.cpp | 9 | ||||
-rw-r--r-- | c++/test/ttypes.cpp | 3 | ||||
-rw-r--r-- | c++/test/tvlstr.cpp | 6 |
16 files changed, 38 insertions, 70 deletions
diff --git a/c++/src/H5DaccProp.cpp b/c++/src/H5DaccProp.cpp index 35c071a..1905f27 100644 --- a/c++/src/H5DaccProp.cpp +++ b/c++/src/H5DaccProp.cpp @@ -72,8 +72,7 @@ DSetAccPropList::getConstant() void DSetAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 0485530..c20a88c 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -69,8 +69,7 @@ DataSpace::getConstant() void DataSpace::deleteConstants() { - if (ALL_ != 0) - delete ALL_; + delete ALL_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DcreatProp.cpp b/c++/src/H5DcreatProp.cpp index 383e38f..34be7ba 100644 --- a/c++/src/H5DcreatProp.cpp +++ b/c++/src/H5DcreatProp.cpp @@ -78,8 +78,7 @@ DSetCreatPropList::getConstant() void DSetCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5DxferProp.cpp b/c++/src/H5DxferProp.cpp index 2b50de4..43ea6f4 100644 --- a/c++/src/H5DxferProp.cpp +++ b/c++/src/H5DxferProp.cpp @@ -72,8 +72,7 @@ DSetMemXferPropList::getConstant() void DSetMemXferPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index 926ac2f..a79ada3 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -76,8 +76,7 @@ FileAccPropList::getConstant() void FileAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5FcreatProp.cpp b/c++/src/H5FcreatProp.cpp index b9be563..b51ba10 100644 --- a/c++/src/H5FcreatProp.cpp +++ b/c++/src/H5FcreatProp.cpp @@ -68,8 +68,7 @@ FileCreatPropList::getConstant() void FileCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5LaccProp.cpp b/c++/src/H5LaccProp.cpp index feaa555..acdaa13 100644 --- a/c++/src/H5LaccProp.cpp +++ b/c++/src/H5LaccProp.cpp @@ -70,8 +70,7 @@ LinkAccPropList::getConstant() void LinkAccPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5LcreatProp.cpp b/c++/src/H5LcreatProp.cpp index 29721c1..63fe861 100644 --- a/c++/src/H5LcreatProp.cpp +++ b/c++/src/H5LcreatProp.cpp @@ -70,8 +70,7 @@ LinkCreatPropList::getConstant() void LinkCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5OcreatProp.cpp b/c++/src/H5OcreatProp.cpp index 81dae31..dffdeb1 100644 --- a/c++/src/H5OcreatProp.cpp +++ b/c++/src/H5OcreatProp.cpp @@ -70,8 +70,7 @@ ObjCreatPropList::getConstant() void ObjCreatPropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 28ab44e..8b45f79 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -71,8 +71,7 @@ PropList::getConstant() void PropList::deleteConstants() { - if (DEFAULT_ != 0) - delete DEFAULT_; + delete DEFAULT_; } //-------------------------------------------------------------------------- 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 } diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 82c21e8..2170a9d 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -176,8 +176,7 @@ test_compound_2() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_2() /*------------------------------------------------------------------------- @@ -287,8 +286,7 @@ test_compound_3() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_3() /*------------------------------------------------------------------------- @@ -407,8 +405,7 @@ test_compound_4() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_4() /*------------------------------------------------------------------------- @@ -504,8 +501,7 @@ test_compound_5() issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); } - if (array_dt) - delete array_dt; + delete array_dt; } // test_compound_5() /*------------------------------------------------------------------------- diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index 5e4e91b..255fc30 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -175,14 +175,14 @@ test_file_create() catch (InvalidActionException &E) { cerr << " *FAILED*" << endl; cerr << " <<< " << E.getDetailMsg() << " >>>" << endl << endl; - if (file1 != NULL) // clean up - delete file1; + // clean up + delete file1; } // catch all other exceptions catch (Exception &E) { issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (file1 != NULL) // clean up - delete file1; + // clean up + delete file1; } // Setting this to NULL for cleaning up in failure situations @@ -260,8 +260,8 @@ test_file_create() // catch all exceptions catch (Exception &E) { issue_fail_msg("test_file_create()", __LINE__, __FILE__, E.getCDetailMsg()); - if (tmpl1 != NULL) // clean up - delete tmpl1; + // clean up + delete tmpl1; } } // test_file_create() diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 939b0ee..604ccc0 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -179,8 +179,7 @@ test_reference_params() issue_fail_msg("test_reference_param()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } /* test_reference_param() */ /*------------------------------------------------------------------------- @@ -374,8 +373,7 @@ test_reference_obj() issue_fail_msg("test_reference_obj()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // test_reference_obj() /*------------------------------------------------------------------------- @@ -518,8 +516,7 @@ test_reference_group() issue_fail_msg("test_reference_group()", __LINE__, __FILE__, E.getCFuncName(), E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } /* test_reference_group() */ /*------------------------------------------------------------------------- diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index 5fc82a5..b633740 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -802,8 +802,7 @@ test_named() issue_fail_msg("test_named", __LINE__, __FILE__, E.getCDetailMsg()); } - if (ds_type) - delete ds_type; + delete ds_type; } // test_named /*------------------------------------------------------------------------- diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index b371518..9c0f78a 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -313,8 +313,7 @@ test_vlstring_array_dataset() issue_fail_msg("test_vlstring_array_dataset()", __LINE__, __FILE__, E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // end test_vlstring_array_dataset() /*------------------------------------------------------------------------- @@ -527,8 +526,7 @@ test_vlstring_type() issue_fail_msg("test_vlstring_type()", __LINE__, __FILE__, E.getCDetailMsg()); } - if (file1) - delete file1; + delete file1; } // end test_vlstring_type() /*------------------------------------------------------------------------- |