Permalink
Browse files

Merge pull request #1313 from robertodr/modernize-use-nullptr

clang-tidy apply modernize-use-nullptr fixes
  • Loading branch information...
andysim committed Oct 29, 2018
2 parents 778bc70 + e36c560 commit 258f326a80dd9bf87e2adb3dafa82f46d86864b5
Showing with 189 additions and 189 deletions.
  1. +1 −1 psi4/src/psi4/libciomr/block_matrix.cc
  2. +1 −1 psi4/src/psi4/libciomr/init_matrix.cc
  3. +1 −1 psi4/src/psi4/libdpd/buf4_mat_irrep_shift13.cc
  4. +1 −1 psi4/src/psi4/libdpd/buf4_mat_irrep_shift31.cc
  5. +12 −12 psi4/src/psi4/libdpd/init.cc
  6. +1 −1 psi4/src/psi4/libdpd/trans4_mat_irrep_shift13.cc
  7. +1 −1 psi4/src/psi4/libdpd/trans4_mat_irrep_shift31.cc
  8. +1 −1 psi4/src/psi4/libmints/cartesianiter.cc
  9. +9 −9 psi4/src/psi4/libmints/chartab.cc
  10. +3 −3 psi4/src/psi4/libmints/corrtab.cc
  11. +32 −32 psi4/src/psi4/libmints/dcd.h
  12. +2 −2 psi4/src/psi4/libmints/deriv.cc
  13. +1 −1 psi4/src/psi4/libmints/fjt.cc
  14. +5 −5 psi4/src/psi4/libmints/irrep.cc
  15. +3 −3 psi4/src/psi4/libmints/matrix.h
  16. +6 −6 psi4/src/psi4/libmints/molecule.cc
  17. +1 −1 psi4/src/psi4/libmints/onebody.cc
  18. +10 −10 psi4/src/psi4/libmints/osrecur.h
  19. +19 −19 psi4/src/psi4/libmints/petitelist.cc
  20. +2 −2 psi4/src/psi4/libmints/pointgrp.h
  21. +4 −4 psi4/src/psi4/libmints/shellrotation.cc
  22. +2 −2 psi4/src/psi4/libmints/sobasis.cc
  23. +1 −1 psi4/src/psi4/libmoinfo/moinfo.cc
  24. +13 −13 psi4/src/psi4/libsapt_solver/sapt.cc
  25. +19 −19 psi4/src/psi4/libtrans/integraltransform.cc
  26. +1 −1 psi4/src/psi4/libtrans/integraltransform_sort_so_tpdm.cc
  27. +5 −5 psi4/src/psi4/mcscf/block_matrix.cc
  28. +4 −4 psi4/src/psi4/mcscf/block_vector.cc
  29. +2 −2 psi4/src/psi4/mcscf/mcscf.cc
  30. +4 −4 psi4/src/psi4/mcscf/sblock_matrix.cc
  31. +2 −2 psi4/src/psi4/mcscf/sblock_matrix.h
  32. +3 −3 psi4/src/psi4/mcscf/sblock_vector.cc
  33. +2 −2 psi4/src/psi4/mcscf/sblock_vector.h
  34. +3 −3 psi4/src/psi4/mcscf/scf.cc
  35. +1 −1 psi4/src/psi4/mrcc/mrcc.cc
  36. +8 −8 psi4/src/psi4/psimrcc/index.cc
  37. +1 −1 psi4/src/psi4/psimrcc/sort.cc
  38. +2 −2 psi4/src/psi4/psimrcc/special_matrices.cc
@@ -78,7 +78,7 @@ PSI_API double **block_matrix(size_t n, size_t m, bool memlock) {
double *B = nullptr;
size_t i;
if (!m || !n) return (static_cast<double **>(0));
if (!m || !n) return (static_cast<double **>(nullptr));
A = new double *[n];
if (A == nullptr) {
@@ -70,7 +70,7 @@ double **init_matrix(size_t n, size_t m) {
double *B = nullptr;
size_t i;
if (!m || !n) return (static_cast<double **>(0));
if (!m || !n) return (static_cast<double **>(nullptr));
// if ((A = (double **) malloc(n * (size_t)sizeof(double *)))==nullptr) {
if ((A = new double *[n]) == nullptr) {
@@ -67,7 +67,7 @@ int DPD::buf4_mat_irrep_shift13(dpdbuf4 *Buf, int buf_block) {
rowtot = Buf->params->rowtot[buf_block];
coltot = Buf->params->coltot[buf_block ^ all_buf_irrep];
if (rowtot == 0 || coltot == 0)
data = 0;
data = nullptr;
else
data = Buf->matrix[buf_block][0];
@@ -67,7 +67,7 @@ int DPD::buf4_mat_irrep_shift31(dpdbuf4 *Buf, int buf_block) {
rowtot = Buf->params->rowtot[buf_block];
coltot = Buf->params->coltot[buf_block ^ all_buf_irrep];
if (rowtot == 0 || coltot == 0)
data = 0;
data = nullptr;
else
data = Buf->matrix[buf_block][0];
@@ -76,7 +76,7 @@ extern int dpd_init(int dpd_num, int nirreps, long int memory, int cachetype, in
extern int dpd_close(int dpd_num) {
if (dpd_list[dpd_num] == 0) throw PSIEXCEPTION("Attempting to close a non-existent DPD instance.");
delete dpd_list[dpd_num];
dpd_list[dpd_num] = 0;
dpd_list[dpd_num] = nullptr;
return 0;
}
@@ -91,17 +91,17 @@ DPD::DPD()
: nirreps(0),
num_subspaces(0),
num_pairs(0),
numorbs(0),
orboff(0),
pairtot(0),
orbspi(0),
orbsym(0),
orbidx2(0),
pairidx(0),
orbs2(0),
pairorb(0),
params2(0),
params4(0) {}
numorbs(nullptr),
orboff(nullptr),
pairtot(nullptr),
orbspi(nullptr),
orbsym(nullptr),
orbidx2(nullptr),
pairidx(nullptr),
orbs2(nullptr),
pairorb(nullptr),
params2(nullptr),
params4(nullptr) {}
DPD::DPD(int dpd_num, int nirreps, long int memory, int cachetype, int *cachefiles, int **cachelist,
dpd_file4_cache_entry *priority, int num_subspaces, std::vector<int *> &spaceArrays) {
@@ -64,7 +64,7 @@ int DPD::trans4_mat_irrep_shift13(dpdtrans4 *Trans, int buf_block) {
rowtot = Trans->buf.params->coltot[buf_block ^ all_buf_irrep];
coltot = Trans->buf.params->rowtot[buf_block];
if (rowtot == 0 || coltot == 0)
data = 0;
data = nullptr;
else
data = Trans->matrix[buf_block][0];
@@ -61,7 +61,7 @@ int DPD::trans4_mat_irrep_shift31(dpdtrans4 *Trans, int buf_block) {
rowtot = Trans->buf.params->coltot[buf_block ^ all_buf_irrep];
coltot = Trans->buf.params->rowtot[buf_block];
if (rowtot == 0 || coltot == 0)
data = 0;
data = nullptr;
else
data = Trans->matrix[buf_block][0];
@@ -56,7 +56,7 @@ CartesianIter::operator int() { return (a_ >= 0); }
////////////////////////////////////////////////////////////////////////
RedundantCartesianIter::RedundantCartesianIter(int l) : done_(0), l_(l), axis_(0) {
RedundantCartesianIter::RedundantCartesianIter(int l) : done_(0), l_(l), axis_(nullptr) {
l_ = l;
axis_ = new int[l_];
}
@@ -89,20 +89,20 @@ using namespace psi;
////////////////////////////////////////////////////////////////////////
CharacterTable::CharacterTable()
: nt(0), pg(PointGroups::C1), nirrep_(0), gamma_(0), symop(0), _inv(0), symb(), bits_(0) {}
: nt(0), pg(PointGroups::C1), nirrep_(0), gamma_(nullptr), symop(nullptr), _inv(nullptr), symb(), bits_(0) {}
CharacterTable::CharacterTable(const CharacterTable& ct)
: nt(0), pg(PointGroups::C1), nirrep_(0), gamma_(0), symop(0), _inv(0), symb(), bits_(0) {
: nt(0), pg(PointGroups::C1), nirrep_(0), gamma_(nullptr), symop(nullptr), _inv(nullptr), symb(), bits_(0) {
*this = ct;
}
CharacterTable::~CharacterTable() {
if (gamma_) delete[] gamma_;
gamma_ = 0;
gamma_ = nullptr;
if (symop) delete[] symop;
symop = 0;
symop = nullptr;
if (_inv) delete[] _inv;
_inv = 0;
_inv = nullptr;
nt = nirrep_ = 0;
}
@@ -114,7 +114,7 @@ CharacterTable& CharacterTable::operator=(const CharacterTable& ct) {
symb = ct.symb;
if (gamma_) delete[] gamma_;
gamma_ = 0;
gamma_ = nullptr;
if (ct.gamma_) {
gamma_ = new IrreducibleRepresentation[nirrep_];
for (int i = 0; i < nirrep_; i++) {
@@ -124,7 +124,7 @@ CharacterTable& CharacterTable::operator=(const CharacterTable& ct) {
}
if (symop) delete[] symop;
symop = 0;
symop = nullptr;
if (ct.symop) {
symop = new SymmetryOperation[nirrep_];
@@ -134,7 +134,7 @@ CharacterTable& CharacterTable::operator=(const CharacterTable& ct) {
}
if (_inv) delete[] _inv;
_inv = 0;
_inv = nullptr;
if (ct._inv) {
_inv = new int[nirrep_];
@@ -179,7 +179,7 @@ void CharacterTable::common_init() {
}
CharacterTable::CharacterTable(const std::string& cpg)
: nt(0), pg(PointGroups::C1), nirrep_(0), gamma_(0), symop(0), _inv(0), symb(cpg), bits_(0) {
: nt(0), pg(PointGroups::C1), nirrep_(0), gamma_(nullptr), symop(nullptr), _inv(nullptr), symb(cpg), bits_(0) {
// Check the symbol coming in
if (!PointGroup::full_name_to_bits(cpg, bits_)) {
outfile->Printf("CharacterTable: Invalid point group name: %s\n", cpg.c_str());
@@ -65,11 +65,11 @@ using namespace psi;
////////////////////////////////////////////////////////////////////////
CorrelationTable::CorrelationTable() : n_(0), ngamma_(0), gamma_(0) {}
CorrelationTable::CorrelationTable() : n_(0), ngamma_(nullptr), gamma_(nullptr) {}
CorrelationTable::CorrelationTable(const std::shared_ptr<PointGroup>& group,
const std::shared_ptr<PointGroup>& subgroup)
: n_(0), ngamma_(0), gamma_(0) {
: n_(0), ngamma_(nullptr), gamma_(nullptr) {
int rc = initialize_table(group, subgroup);
if (rc != 0) {
// ExEnv::err0()
@@ -104,7 +104,7 @@ int CorrelationTable::initialize_table(const std::shared_ptr<PointGroup>& group,
for (i = 0; i < n_; i++) {
ngamma_[i] = 0;
gamma_[i] = 0;
gamma_[i] = nullptr;
}
// map the ops in the high order to low order groups
@@ -75,22 +75,22 @@ class DCD {
* @param pg the point group of the molecule, in bitwise representation
*/
DCD(int pg) {
C1_operators_ = 0;
C2_z_operators_ = 0;
C2_y_operators_ = 0;
C2_x_operators_ = 0;
D2_operators_ = 0;
Ci_operators_ = 0;
Cs_xy_operators_ = 0;
C2h_z_operators_ = 0;
Cs_xz_operators_ = 0;
C2h_y_operators_ = 0;
C2v_x_operators_ = 0;
Cs_yz_operators_ = 0;
C2h_x_operators_ = 0;
C2v_y_operators_ = 0;
C2v_z_operators_ = 0;
D2h_operators_ = 0;
C1_operators_ = nullptr;
C2_z_operators_ = nullptr;
C2_y_operators_ = nullptr;
C2_x_operators_ = nullptr;
D2_operators_ = nullptr;
Ci_operators_ = nullptr;
Cs_xy_operators_ = nullptr;
C2h_z_operators_ = nullptr;
Cs_xz_operators_ = nullptr;
C2h_y_operators_ = nullptr;
C2v_x_operators_ = nullptr;
Cs_yz_operators_ = nullptr;
C2h_x_operators_ = nullptr;
C2v_y_operators_ = nullptr;
C2v_z_operators_ = nullptr;
D2h_operators_ = nullptr;
if (pg == 0) { // C1
nsub_ = 1;
subgroup_dimensions_ = new int[1];
@@ -1655,22 +1655,22 @@ class DCD {
}
~DCD() {
if (C1_operators_ != 0) delete[] C1_operators_;
if (C2_z_operators_ != 0) delete[] C2_z_operators_;
if (C2_y_operators_ != 0) delete[] C2_y_operators_;
if (C2_x_operators_ != 0) delete[] C2_x_operators_;
if (D2_operators_ != 0) delete[] D2_operators_;
if (Ci_operators_ != 0) delete[] Ci_operators_;
if (Cs_xy_operators_ != 0) delete[] Cs_xy_operators_;
if (C2h_z_operators_ != 0) delete[] C2h_z_operators_;
if (Cs_xz_operators_ != 0) delete[] Cs_xz_operators_;
if (C2h_y_operators_ != 0) delete[] C2h_y_operators_;
if (C2v_x_operators_ != 0) delete[] C2v_x_operators_;
if (Cs_yz_operators_ != 0) delete[] Cs_yz_operators_;
if (C2h_x_operators_ != 0) delete[] C2h_x_operators_;
if (C2v_y_operators_ != 0) delete[] C2v_y_operators_;
if (C2v_z_operators_ != 0) delete[] C2v_z_operators_;
if (D2h_operators_ != 0) delete[] D2h_operators_;
if (C1_operators_ != nullptr) delete[] C1_operators_;
if (C2_z_operators_ != nullptr) delete[] C2_z_operators_;
if (C2_y_operators_ != nullptr) delete[] C2_y_operators_;
if (C2_x_operators_ != nullptr) delete[] C2_x_operators_;
if (D2_operators_ != nullptr) delete[] D2_operators_;
if (Ci_operators_ != nullptr) delete[] Ci_operators_;
if (Cs_xy_operators_ != nullptr) delete[] Cs_xy_operators_;
if (C2h_z_operators_ != nullptr) delete[] C2h_z_operators_;
if (Cs_xz_operators_ != nullptr) delete[] Cs_xz_operators_;
if (C2h_y_operators_ != nullptr) delete[] C2h_y_operators_;
if (C2v_x_operators_ != nullptr) delete[] C2v_x_operators_;
if (Cs_yz_operators_ != nullptr) delete[] Cs_yz_operators_;
if (C2h_x_operators_ != nullptr) delete[] C2h_x_operators_;
if (C2v_y_operators_ != nullptr) delete[] C2v_y_operators_;
if (C2v_z_operators_ != nullptr) delete[] C2v_z_operators_;
if (D2h_operators_ != nullptr) delete[] D2h_operators_;
for (int n = 0; n < nsub_; ++n) delete[] gng_[n];
delete[] gng_;
@@ -429,8 +429,8 @@ SharedMatrix Deriv::compute() {
SharedVector X_ref_cont_vector;
double *Xcont = Xcont_vector->pointer();
double *TPDMcont = TPDMcont_vector->pointer();
double *TPDM_ref_cont = 0;
double *X_ref_cont = 0;
double *TPDM_ref_cont = nullptr;
double *X_ref_cont = nullptr;
if (!wfn_) throw("In Deriv: The wavefunction passed in is empty!");
@@ -193,7 +193,7 @@ Taylor_Fjt::Taylor_Fjt(size_t mmax, double accuracy)
Taylor_Fjt::~Taylor_Fjt() {
delete[] F_;
delete[] T_crit_;
T_crit_ = 0;
T_crit_ = nullptr;
free_block(grid_);
grid_ = nullptr;
}
@@ -85,15 +85,15 @@ using namespace psi;
/////////////////////////////////////////////////////////////////////////
IrreducibleRepresentation::IrreducibleRepresentation()
: g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(0), csymb(0), rep(0) {}
: g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(nullptr), csymb(nullptr), rep(nullptr) {}
IrreducibleRepresentation::IrreducibleRepresentation(int order, int d, const char *lab, const char *clab)
: g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(0), csymb(0), rep(0) {
: g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(nullptr), csymb(nullptr), rep(nullptr) {
init(order, d, lab, clab);
}
IrreducibleRepresentation::IrreducibleRepresentation(const IrreducibleRepresentation &ir)
: g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(0), csymb(0), rep(0) {
: g(0), degen(0), nrot_(0), ntrans_(0), complex_(0), symb(nullptr), csymb(nullptr), rep(nullptr) {
*this = ir;
}
@@ -126,11 +126,11 @@ void IrreducibleRepresentation::init(int order, int d, const char *lab, const ch
if (clab)
csymb = strdup(clab);
else
csymb = 0;
csymb = nullptr;
if (rep) {
delete[] rep;
rep = 0;
rep = nullptr;
}
if (g) {
@@ -479,13 +479,13 @@ class PSI_API Matrix : public std::enable_shared_from_this<Matrix> {
if (rowspi_[h] * (size_t)colspi_[h] > 0)
return &(matrix_[h][0][0]);
else
return 0;
return nullptr;
}
const double* get_const_pointer(const int& h = 0) const {
if (rowspi_[h] * (size_t)colspi_[h] > 0)
return const_cast<const double*>(&(matrix_[h][0][0]));
else
return 0;
return nullptr;
}
size_t size(const int& h = 0) const { return colspi_[h] * (size_t)rowspi_[h]; }
@@ -1024,7 +1024,7 @@ class PSI_API Matrix : public std::enable_shared_from_this<Matrix> {
* \param tol is the tolerance.
* \returns A Dimension object tell you how many were removed in each irrep.
*/
Dimension schmidt_orthog_columns(SharedMatrix S, double tol, double* res = 0);
Dimension schmidt_orthog_columns(SharedMatrix S, double tol, double* res = nullptr);
/*!
* Project out the row vectors in the matrix provided out of this matrix.
@@ -147,11 +147,11 @@ Molecule::Molecule()
full_pg_(PG_C1),
full_pg_n_(1),
nunique_(0),
nequiv_(0),
equiv_(0),
nequiv_(nullptr),
equiv_(nullptr),
zmat_(false),
cart_(false),
atom_to_unique_(0),
atom_to_unique_(nullptr),
// old_symmetry_frame_(0)
reinterpret_coordentries_(true),
lock_frame_(false) {}
@@ -187,9 +187,9 @@ Molecule &Molecule::operator=(const Molecule &other) {
// These are symmetry related variables, and are filled in by the following functions
pg_ = std::shared_ptr<PointGroup>();
nunique_ = 0;
nequiv_ = 0;
equiv_ = 0;
atom_to_unique_ = 0;
nequiv_ = nullptr;
equiv_ = nullptr;
atom_to_unique_ = nullptr;
symmetry_from_input_ = other.symmetry_from_input_;
form_symmetry_information();
full_pg_ = other.full_pg_;
@@ -81,7 +81,7 @@ OneBodyAOInt::OneBodyAOInt(std::vector<SphericalTransform> &spherical_transforms
std::shared_ptr<BasisSet> bs2, int deriv)
: bs1_(bs1), bs2_(bs2), spherical_transforms_(spherical_transforms), deriv_(deriv), nchunk_(1) {
force_cartesian_ = false;
buffer_ = 0;
buffer_ = nullptr;
natom_ = bs1_->molecule()->natom();
size_t buffsize = INT_NCART(bs1->max_am()) * INT_NCART(bs2->max_am());
Oops, something went wrong.

0 comments on commit 258f326

Please sign in to comment.