T2345: Replace instances of NULL with nullptr

Per guidance from Axel, revert lib/kokkos and lib/colvars
to remove nullptr changes.
This commit is contained in:
Anne Gunn
2020-09-11 08:53:44 -06:00
parent 9a5d8fd18b
commit f524fa758d
31 changed files with 196 additions and 196 deletions

View File

@ -22,7 +22,7 @@
colvar::colvar()
{
runave_os = nullptr;
runave_os = NULL;
prev_timestep = -1L;
after_restart = false;
@ -62,7 +62,7 @@ int colvar::init(std::string const &conf)
get_keyval(conf, "name", this->name,
(std::string("colvar")+cvm::to_str(cv->variables()->size())));
if ((cvm::colvar_by_name(this->name) != nullptr) &&
if ((cvm::colvar_by_name(this->name) != NULL) &&
(cvm::colvar_by_name(this->name) != this)) {
cvm::error("Error: this colvar cannot have the same name, \""+this->name+
"\", as another colvar.\n",
@ -744,7 +744,7 @@ template<typename def_class_name> int colvar::init_components_type(std::string c
: ".\n"));
cvm::increase_depth();
cvc *cvcp = new def_class_name(def_conf);
if (cvcp != nullptr) {
if (cvcp != NULL) {
cvcs.push_back(cvcp);
cvcp->check_keywords(def_conf, def_config_key);
cvcp->config_key = def_config_key;
@ -994,7 +994,7 @@ int colvar::parse_analysis(std::string const &conf)
acf_type = acf_vel;
enable(f_cv_fdiff_velocity);
colvar *cv2 = cvm::colvar_by_name(acf_colvar_name);
if (cv2 == nullptr) {
if (cv2 == NULL) {
return cvm::error("Error: collective variable \""+acf_colvar_name+
"\" is not defined at this time.\n", INPUT_ERROR);
}
@ -1215,14 +1215,14 @@ colvar::~colvar()
for (std::vector<Lepton::CompiledExpression *>::iterator cei = value_evaluators.begin();
cei != value_evaluators.end();
++cei) {
if (*cei != nullptr) delete (*cei);
if (*cei != NULL) delete (*cei);
}
value_evaluators.clear();
for (std::vector<Lepton::CompiledExpression *>::iterator gei = gradient_evaluators.begin();
gei != gradient_evaluators.end();
++gei) {
if (*gei != nullptr) delete (*gei);
if (*gei != NULL) delete (*gei);
}
gradient_evaluators.clear();
#endif
@ -1972,7 +1972,7 @@ void const *colvar::get_cvc_param_ptr(std::string const &param_name)
}
cvm::error("Error: calling colvar::get_cvc_param() for a variable "
"with more than one component.\n", COLVARS_NOT_IMPLEMENTED);
return nullptr;
return NULL;
}
@ -1983,7 +1983,7 @@ colvarvalue const *colvar::get_cvc_param_grad(std::string const &param_name)
}
cvm::error("Error: calling colvar::get_cvc_param_grad() for a variable "
"with more than one component.\n", COLVARS_NOT_IMPLEMENTED);
return nullptr;
return NULL;
}
@ -2422,7 +2422,7 @@ int colvar::calc_acf()
// the pointer to each vector is changed at every step
colvar const *cfcv = cvm::colvar_by_name(acf_colvar_name);
if (cfcv == nullptr) {
if (cfcv == NULL) {
return cvm::error("Error: collective variable \""+acf_colvar_name+
"\" is not defined at this time.\n", INPUT_ERROR);
}
@ -2660,7 +2660,7 @@ int colvar::calc_runave()
if ((*x_history_p).size() >= runave_length-1) {
if (runave_os == nullptr) {
if (runave_os == NULL) {
if (runave_outfile.size() == 0) {
runave_outfile = std::string(cvm::output_prefix()+"."+
this->name+".runave.traj");

View File

@ -105,7 +105,7 @@ cvm::atom_group::~atom_group()
if (fitting_group) {
delete fitting_group;
fitting_group = nullptr;
fitting_group = NULL;
}
cvm::main()->unregister_named_atom_group(this);
@ -217,7 +217,7 @@ int cvm::atom_group::init()
b_center = false;
b_rotate = false;
b_user_defined_fit = false;
fitting_group = nullptr;
fitting_group = NULL;
noforce = false;
@ -368,7 +368,7 @@ int cvm::atom_group::parse(std::string const &group_conf)
// Optional group name will let other groups reuse atom definition
if (get_keyval(group_conf, "name", name)) {
if ((cvm::atom_group_by_name(this->name) != nullptr) &&
if ((cvm::atom_group_by_name(this->name) != NULL) &&
(cvm::atom_group_by_name(this->name) != this)) {
cvm::error("Error: this atom group cannot have the same name, \""+this->name+
"\", as another atom group.\n",
@ -395,7 +395,7 @@ int cvm::atom_group::parse(std::string const &group_conf)
std::string atoms_of = "";
if (get_keyval(group_conf, "atomsOfGroup", atoms_of)) {
atom_group * ag = atom_group_by_name(atoms_of);
if (ag == nullptr) {
if (ag == NULL) {
cvm::error("Error: cannot find atom group with name " + atoms_of + ".\n");
return COLVARS_ERROR;
}

View File

@ -47,7 +47,7 @@ int colvarbias::init(std::string const &conf)
{
colvarbias *bias_with_name = cvm::bias_by_name(this->name);
if (bias_with_name != nullptr) {
if (bias_with_name != NULL) {
if ((bias_with_name->rank != this->rank) ||
(bias_with_name->bias_type != this->bias_type)) {
cvm::error("Error: this bias cannot have the same name, \""+this->name+
@ -295,8 +295,8 @@ int colvarbias::update()
colvar_values[i] = colvars[i]->value();
}
error_code |= calc_energy(nullptr);
error_code |= calc_forces(nullptr);
error_code |= calc_energy(NULL);
error_code |= calc_forces(NULL);
return error_code;
}
@ -547,8 +547,8 @@ colvarbias_ti::colvarbias_ti(char const *key)
: colvarbias(key)
{
provide(f_cvb_calc_ti_samples);
ti_avg_forces = nullptr;
ti_count = nullptr;
ti_avg_forces = NULL;
ti_count = NULL;
}
@ -560,13 +560,13 @@ colvarbias_ti::~colvarbias_ti()
int colvarbias_ti::clear_state_data()
{
if (ti_avg_forces != nullptr) {
if (ti_avg_forces != NULL) {
delete ti_avg_forces;
ti_avg_forces = nullptr;
ti_avg_forces = NULL;
}
if (ti_count != nullptr) {
if (ti_count != NULL) {
delete ti_count;
ti_count = nullptr;
ti_count = NULL;
}
return COLVARS_OK;
}
@ -622,7 +622,7 @@ int colvarbias_ti::init(std::string const &conf)
int colvarbias_ti::init_grids()
{
if (is_enabled(f_cvb_calc_ti_samples)) {
if (ti_avg_forces == nullptr) {
if (ti_avg_forces == NULL) {
ti_bin.resize(num_variables());
ti_system_forces.resize(num_variables());
for (size_t icv = 0; icv < num_variables(); icv++) {
@ -643,7 +643,7 @@ int colvarbias_ti::init_grids()
int colvarbias_ti::update()
{
return update_system_forces(nullptr);
return update_system_forces(NULL);
}
@ -679,7 +679,7 @@ int colvarbias_ti::update_system_forces(std::vector<colvarvalue> const
ti_system_forces[i] = variables(i)->total_force();
} else {
ti_system_forces[i] = variables(i)->total_force() -
((subtract_forces != nullptr) ?
((subtract_forces != NULL) ?
(*subtract_forces)[i] : previous_colvar_forces[i]);
}
}
@ -759,7 +759,7 @@ int colvarbias_ti::write_output_files()
std::string const ti_output_prefix = cvm::output_prefix()+"."+this->name;
std::ostream *os = nullptr;
std::ostream *os = NULL;
if (is_enabled(f_cvb_write_ti_samples)) {
std::string const ti_count_file_name(ti_output_prefix+".ti.count");

View File

@ -58,12 +58,12 @@ public:
virtual int update();
/// Compute the energy of the bias
/// Uses the vector of colvar values provided if not nullptr, and the values
/// Uses the vector of colvar values provided if not NULL, and the values
/// currently cached in the bias instance otherwise
virtual int calc_energy(std::vector<colvarvalue> const *values);
/// Compute the forces due to the bias
/// Uses the vector of colvar values provided if not nullptr, and the values
/// Uses the vector of colvar values provided if not NULL, and the values
/// currently cached in the bias instance otherwise
virtual int calc_forces(std::vector<colvarvalue> const *values);

View File

@ -18,16 +18,16 @@ colvarbias_abf::colvarbias_abf(char const *key)
b_UI_estimator(false),
b_CZAR_estimator(false),
pabf_freq(0),
system_force(nullptr),
gradients(nullptr),
samples(nullptr),
pmf(nullptr),
z_gradients(nullptr),
z_samples(nullptr),
czar_gradients(nullptr),
czar_pmf(nullptr),
last_gradients(nullptr),
last_samples(nullptr)
system_force(NULL),
gradients(NULL),
samples(NULL),
pmf(NULL),
z_gradients(NULL),
z_samples(NULL),
czar_gradients(NULL),
czar_pmf(NULL),
last_gradients(NULL),
last_samples(NULL)
{
}
@ -261,37 +261,37 @@ colvarbias_abf::~colvarbias_abf()
{
if (samples) {
delete samples;
samples = nullptr;
samples = NULL;
}
if (gradients) {
delete gradients;
gradients = nullptr;
gradients = NULL;
}
if (pmf) {
delete pmf;
pmf = nullptr;
pmf = NULL;
}
if (z_samples) {
delete z_samples;
z_samples = nullptr;
z_samples = NULL;
}
if (z_gradients) {
delete z_gradients;
z_gradients = nullptr;
z_gradients = NULL;
}
if (czar_gradients) {
delete czar_gradients;
czar_gradients = nullptr;
czar_gradients = NULL;
}
if (czar_pmf) {
delete czar_pmf;
czar_pmf = nullptr;
czar_pmf = NULL;
}
// shared ABF
@ -299,17 +299,17 @@ colvarbias_abf::~colvarbias_abf()
// but now we can call shared externally
if (last_samples) {
delete last_samples;
last_samples = nullptr;
last_samples = NULL;
}
if (last_gradients) {
delete last_gradients;
last_gradients = nullptr;
last_gradients = NULL;
}
if (system_force) {
delete [] system_force;
system_force = nullptr;
system_force = NULL;
}
}
@ -488,7 +488,7 @@ int colvarbias_abf::update()
}
/// Add the bias energy for 1D ABF
bias_energy = calc_energy(nullptr);
bias_energy = calc_energy(NULL);
return COLVARS_OK;
}

View File

@ -15,7 +15,7 @@
colvarbias_histogram::colvarbias_histogram(char const *key)
: colvarbias(key),
grid(nullptr), out_name("")
grid(NULL), out_name("")
{
provide(f_cvb_bypass_ext_lagrangian); // Allow histograms of actual cv for extended-Lagrangian
}
@ -105,7 +105,7 @@ colvarbias_histogram::~colvarbias_histogram()
{
if (grid) {
delete grid;
grid = nullptr;
grid = NULL;
}
}

View File

@ -36,7 +36,7 @@ colvarbias_meta::colvarbias_meta(char const *key)
: colvarbias(key), colvarbias_ti(key)
{
new_hills_begin = hills.end();
hills_traj_os = nullptr;
hills_traj_os = NULL;
hill_width = 0.0;
@ -45,8 +45,8 @@ colvarbias_meta::colvarbias_meta(char const *key)
use_grids = true;
grids_freq = 0;
rebin_grids = false;
hills_energy = nullptr;
hills_energy_gradients = nullptr;
hills_energy = NULL;
hills_energy_gradients = NULL;
dump_fes = true;
keep_hills = false;
@ -153,7 +153,7 @@ int colvarbias_meta::init(std::string const &conf)
get_keyval(conf, "keepHills", keep_hills, keep_hills);
get_keyval(conf, "keepFreeEnergyFiles", dump_fes_save, dump_fes_save);
if (hills_energy == nullptr) {
if (hills_energy == NULL) {
hills_energy = new colvar_grid_scalar(colvars);
hills_energy_gradients = new colvar_grid_gradient(colvars);
}
@ -262,7 +262,7 @@ int colvarbias_meta::init_well_tempered_params(std::string const &conf)
int colvarbias_meta::init_ebmeta_params(std::string const &conf)
{
// for ebmeta
target_dist = nullptr;
target_dist = NULL;
get_keyval(conf, "ebMeta", ebmeta, false);
if(ebmeta){
if (use_grids && expand_grids) {
@ -328,12 +328,12 @@ colvarbias_meta::~colvarbias_meta()
if (hills_traj_os) {
proxy->close_output_stream(hills_traj_file_name());
hills_traj_os = nullptr;
hills_traj_os = NULL;
}
if (target_dist) {
delete target_dist;
target_dist = nullptr;
target_dist = NULL;
}
}
@ -342,12 +342,12 @@ int colvarbias_meta::clear_state_data()
{
if (hills_energy) {
delete hills_energy;
hills_energy = nullptr;
hills_energy = NULL;
}
if (hills_energy_gradients) {
delete hills_energy_gradients;
hills_energy_gradients = nullptr;
hills_energy_gradients = NULL;
}
hills.clear();
@ -451,8 +451,8 @@ int colvarbias_meta::update()
error_code |= replica_share();
}
error_code |= calc_energy(nullptr);
error_code |= calc_forces(nullptr);
error_code |= calc_energy(NULL);
error_code |= calc_forces(NULL);
return error_code;
}
@ -593,7 +593,7 @@ int colvarbias_meta::update_bias()
std::vector<int> curr_bin = hills_energy->get_colvars_index();
hills_energy_sum_here = hills_energy->value(curr_bin);
} else {
calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, nullptr);
calc_hills(new_hills_begin, hills.end(), hills_energy_sum_here, NULL);
}
hills_scale *= cvm::exp(-1.0*hills_energy_sum_here/(bias_temperature*cvm::boltzmann()));
}
@ -887,14 +887,14 @@ void colvarbias_meta::project_hills(colvarbias_meta::hill_iter h_first,
std::vector<cvm::real> colvar_forces_scalar(num_variables());
std::vector<int> he_ix = he->new_index();
std::vector<int> hg_ix = (hg != nullptr) ? hg->new_index() : std::vector<int> (0);
std::vector<int> hg_ix = (hg != NULL) ? hg->new_index() : std::vector<int> (0);
cvm::real hills_energy_here = 0.0;
std::vector<colvarvalue> hills_forces_here(num_variables(), 0.0);
size_t count = 0;
size_t const print_frequency = ((hills.size() >= 1000000) ? 1 : (1000000/(hills.size()+1)));
if (hg != nullptr) {
if (hg != NULL) {
// loop over the points of the grid
for ( ;
@ -1310,8 +1310,8 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
hills_energy_gradients = new colvar_grid_gradient(colvars);
}
colvar_grid_scalar *hills_energy_backup = nullptr;
colvar_grid_gradient *hills_energy_gradients_backup = nullptr;
colvar_grid_scalar *hills_energy_backup = NULL;
colvar_grid_gradient *hills_energy_gradients_backup = NULL;
if (has_data) {
if (cvm::debug())
@ -1327,7 +1327,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
size_t const hills_energy_pos = is.tellg();
std::string key;
if (!(is >> key)) {
if (hills_energy_backup != nullptr) {
if (hills_energy_backup != NULL) {
delete hills_energy;
delete hills_energy_gradients;
hills_energy = hills_energy_backup;
@ -1343,7 +1343,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
is.seekg(hills_energy_pos, std::ios::beg);
grids_from_restart_file = false;
if (!rebin_grids) {
if (hills_energy_backup == nullptr)
if (hills_energy_backup == NULL)
cvm::fatal_error("Error: couldn't read the free energy grid for metadynamics bias \""+
this->name+"\""+
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+
@ -1365,7 +1365,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
size_t const hills_energy_gradients_pos = is.tellg();
if (!(is >> key)) {
if (hills_energy_backup != nullptr) {
if (hills_energy_backup != NULL) {
delete hills_energy;
delete hills_energy_gradients;
hills_energy = hills_energy_backup;
@ -1381,7 +1381,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
is.seekg(hills_energy_gradients_pos, std::ios::beg);
grids_from_restart_file = false;
if (!rebin_grids) {
if (hills_energy_backup == nullptr)
if (hills_energy_backup == NULL)
cvm::fatal_error("Error: couldn't read the free energy gradients grid for metadynamics bias \""+
this->name+"\""+
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+
@ -1406,7 +1406,7 @@ std::istream & colvarbias_meta::read_state_data(std::istream& is)
this->name+"\""+
((comm != single_replica) ? ", replica \""+replica_id+"\"" : "")+"\n");
if (hills_energy_backup != nullptr) {
if (hills_energy_backup != NULL) {
// now that we have successfully updated the grids, delete the
// backup copies
if (cvm::debug())
@ -1594,7 +1594,7 @@ int colvarbias_meta::setup_output()
// TODO: one may want to specify the path manually for intricated filesystems?
char *pwd = new char[3001];
if (GETCWD(pwd, 3000) == nullptr)
if (GETCWD(pwd, 3000) == NULL)
cvm::fatal_error("Error: cannot get the path of the current working directory.\n");
replica_list_file =
(std::string(pwd)+std::string(PATHSEP)+
@ -1885,7 +1885,7 @@ int colvarbias_meta::reopen_replica_buffer_file()
{
int error_code = COLVARS_OK;
colvarproxy *proxy = cvm::proxy;
if (proxy->get_output_stream(replica_hills_file) != nullptr) {
if (proxy->get_output_stream(replica_hills_file) != NULL) {
error_code |= proxy->close_output_stream(replica_hills_file);
}
error_code |= proxy->remove_file(replica_hills_file);

View File

@ -135,7 +135,7 @@ cvm::atom_group *colvar::cvc::parse_group(std::string const &conf,
char const *group_key,
bool optional)
{
cvm::atom_group *group = nullptr;
cvm::atom_group *group = NULL;
std::string group_conf;
if (key_lookup(conf, group_key, &group_conf)) {
@ -298,7 +298,7 @@ colvar::cvc::~cvc()
free_children_deps();
remove_all_children();
for (size_t i = 0; i < atom_groups.size(); i++) {
if (atom_groups[i] != nullptr) delete atom_groups[i];
if (atom_groups[i] != NULL) delete atom_groups[i];
}
}
@ -344,7 +344,7 @@ colvarvalue const *colvar::cvc::get_param_grad(std::string const &param_name)
{
colvarvalue const *ptr =
reinterpret_cast<colvarvalue const *>(get_param_grad_ptr(param_name));
return ptr != nullptr ? ptr : nullptr;
return ptr != NULL ? ptr : NULL;
}
@ -553,7 +553,7 @@ void colvar::cvc::debug_gradients()
}
}
if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != nullptr)) {
if ((group->is_enabled(f_ag_fit_gradients)) && (group->fitting_group != NULL)) {
cvm::atom_group *ref_group = group->fitting_group;
group->read_positions();
group->calc_required_properties();

View File

@ -91,7 +91,7 @@ cvm::real colvar::coordnum::switching_function(cvm::real const &r0,
colvar::coordnum::coordnum(std::string const &conf)
: cvc(conf), b_anisotropic(false), pairlist(nullptr)
: cvc(conf), b_anisotropic(false), pairlist(NULL)
{
function_type = "coordnum";
@ -102,7 +102,7 @@ colvar::coordnum::coordnum(std::string const &conf)
group1 = parse_group(conf, "group1");
group2 = parse_group(conf, "group2");
if (group1 == nullptr || group2 == nullptr) {
if (group1 == NULL || group2 == NULL) {
cvm::error("Error: failed to initialize atom groups.\n",
INPUT_ERROR);
return;
@ -183,7 +183,7 @@ colvar::coordnum::coordnum(std::string const &conf)
colvar::coordnum::~coordnum()
{
if (pairlist != nullptr) {
if (pairlist != NULL) {
delete [] pairlist;
}
}
@ -218,11 +218,11 @@ template<int flags> void colvar::coordnum::main_loop(bool **pairlist_elem)
template<int compute_flags> int colvar::coordnum::compute_coordnum()
{
bool const use_pairlist = (pairlist != nullptr);
bool const rebuild_pairlist = (pairlist != nullptr) &&
bool const use_pairlist = (pairlist != NULL);
bool const rebuild_pairlist = (pairlist != NULL) &&
(cvm::step_relative() % pairlist_freq == 0);
bool *pairlist_elem = use_pairlist ? pairlist : nullptr;
bool *pairlist_elem = use_pairlist ? pairlist : NULL;
if (b_anisotropic) {
@ -239,7 +239,7 @@ template<int compute_flags> int colvar::coordnum::compute_coordnum()
} else {
int const flags = compute_flags | ef_anisotropic;
main_loop<flags>(nullptr);
main_loop<flags>(NULL);
}
} else {
@ -257,7 +257,7 @@ template<int compute_flags> int colvar::coordnum::compute_coordnum()
} else {
int const flags = compute_flags;
main_loop<flags>(nullptr);
main_loop<flags>(NULL);
}
}
@ -367,7 +367,7 @@ void colvar::h_bond::calc_value()
coordnum::switching_function<flags>(r0, r0_vec, en, ed,
(*atom_groups[0])[0],
(*atom_groups[0])[1],
nullptr, 0.0);
NULL, 0.0);
}
@ -378,7 +378,7 @@ void colvar::h_bond::calc_gradients()
coordnum::switching_function<flags>(r0, r0_vec, en, ed,
(*atom_groups[0])[0],
(*atom_groups[0])[1],
nullptr, 0.0);
NULL, 0.0);
}
@ -393,7 +393,7 @@ simple_scalar_dist_functions(h_bond)
colvar::selfcoordnum::selfcoordnum(std::string const &conf)
: cvc(conf), pairlist(nullptr)
: cvc(conf), pairlist(NULL)
{
function_type = "selfcoordnum";
x.type(colvarvalue::type_scalar);
@ -438,7 +438,7 @@ colvar::selfcoordnum::selfcoordnum(std::string const &conf)
colvar::selfcoordnum::~selfcoordnum()
{
if (pairlist != nullptr) {
if (pairlist != NULL) {
delete [] pairlist;
}
}
@ -448,11 +448,11 @@ template<int compute_flags> int colvar::selfcoordnum::compute_selfcoordnum()
{
cvm::rvector const r0_vec(0.0); // TODO enable the flag?
bool const use_pairlist = (pairlist != nullptr);
bool const rebuild_pairlist = (pairlist != nullptr) &&
bool const use_pairlist = (pairlist != NULL);
bool const rebuild_pairlist = (pairlist != NULL) &&
(cvm::step_relative() % pairlist_freq == 0);
bool *pairlist_elem = use_pairlist ? pairlist : nullptr;
bool *pairlist_elem = use_pairlist ? pairlist : NULL;
size_t i = 0, j = 0;
size_t const n = group1->size();
@ -601,13 +601,13 @@ void colvar::groupcoordnum::calc_value()
x.real_value = coordnum::switching_function<flags>(r0, r0_vec, en, ed,
group1_com_atom,
group2_com_atom,
nullptr, 0.0);
NULL, 0.0);
} else {
int const flags = coordnum::ef_null;
x.real_value = coordnum::switching_function<flags>(r0, r0_vec, en, ed,
group1_com_atom,
group2_com_atom,
nullptr, 0.0);
NULL, 0.0);
}
}
@ -624,13 +624,13 @@ void colvar::groupcoordnum::calc_gradients()
coordnum::switching_function<flags>(r0, r0_vec, en, ed,
group1_com_atom,
group2_com_atom,
nullptr, 0.0);
NULL, 0.0);
} else {
int const flags = coordnum::ef_gradients;
coordnum::switching_function<flags>(r0, r0_vec, en, ed,
group1_com_atom,
group2_com_atom,
nullptr, 0.0);
NULL, 0.0);
}
group1->set_weighted_gradient(group1_com_atom.grad);

View File

@ -964,7 +964,7 @@ colvar::rmsd::rmsd(std::string const &conf)
}
bool b_Jacobian_derivative = true;
if (atoms->fitting_group != nullptr && b_Jacobian_derivative) {
if (atoms->fitting_group != NULL && b_Jacobian_derivative) {
cvm::log("The option \"fittingGroup\" (alternative group for fitting) was enabled: "
"Jacobian derivatives of the RMSD will not be calculated.\n");
b_Jacobian_derivative = false;

View File

@ -33,7 +33,7 @@ colvardeps::~colvardeps() {
// Do not delete features if it's a static object
// may change in the future though
// for (i=0; i<features.size(); i++) {
// if (features[i] != nullptr) delete features[i];
// if (features[i] != NULL) delete features[i];
// }
remove_all_children();

View File

@ -34,21 +34,21 @@ colvar_grid_count::colvar_grid_count(std::vector<colvar *> &colvars,
{}
colvar_grid_scalar::colvar_grid_scalar()
: colvar_grid<cvm::real>(), samples(nullptr)
: colvar_grid<cvm::real>(), samples(NULL)
{}
colvar_grid_scalar::colvar_grid_scalar(colvar_grid_scalar const &g)
: colvar_grid<cvm::real>(g), samples(nullptr)
: colvar_grid<cvm::real>(g), samples(NULL)
{
}
colvar_grid_scalar::colvar_grid_scalar(std::vector<int> const &nx_i)
: colvar_grid<cvm::real>(nx_i, 0.0, 1), samples(nullptr)
: colvar_grid<cvm::real>(nx_i, 0.0, 1), samples(NULL)
{
}
colvar_grid_scalar::colvar_grid_scalar(std::vector<colvar *> &colvars, bool margin)
: colvar_grid<cvm::real>(colvars, 0.0, 1, margin), samples(nullptr)
: colvar_grid<cvm::real>(colvars, 0.0, 1, margin), samples(NULL)
{
}
@ -122,15 +122,15 @@ cvm::real colvar_grid_scalar::entropy() const
colvar_grid_gradient::colvar_grid_gradient()
: colvar_grid<cvm::real>(), samples(nullptr)
: colvar_grid<cvm::real>(), samples(NULL)
{}
colvar_grid_gradient::colvar_grid_gradient(std::vector<int> const &nx_i)
: colvar_grid<cvm::real>(nx_i, 0.0, nx_i.size()), samples(nullptr)
: colvar_grid<cvm::real>(nx_i, 0.0, nx_i.size()), samples(NULL)
{}
colvar_grid_gradient::colvar_grid_gradient(std::vector<colvar *> &colvars)
: colvar_grid<cvm::real>(colvars, 0.0, colvars.size()), samples(nullptr)
: colvar_grid<cvm::real>(colvars, 0.0, colvars.size()), samples(NULL)
{}
void colvar_grid_gradient::write_1D_integral(std::ostream &os)

View File

@ -30,11 +30,11 @@ colvarmodule::colvarmodule(colvarproxy *proxy_in)
depth_s = 0;
log_level_ = 10;
cv_traj_os = nullptr;
cv_traj_os = NULL;
xyz_reader_use_count = 0;
if (proxy == nullptr) {
if (proxy == NULL) {
proxy = proxy_in; // Pointer to the proxy object
parse = new colvarparse(); // Parsing object for global options
version_int = proxy->get_version_from_string(COLVARS_VERSION);
@ -573,7 +573,7 @@ colvarbias * colvarmodule::bias_by_name(std::string const &name)
return (*bi);
}
}
return nullptr;
return NULL;
}
@ -587,7 +587,7 @@ colvar *colvarmodule::colvar_by_name(std::string const &name)
return (*cvi);
}
}
return nullptr;
return NULL;
}
@ -601,7 +601,7 @@ cvm::atom_group *colvarmodule::atom_group_by_name(std::string const &name)
return (*agi);
}
}
return nullptr;
return NULL;
}
@ -631,7 +631,7 @@ int colvarmodule::change_configuration(std::string const &bias_name,
cvm::increase_depth();
colvarbias *b;
b = bias_by_name(bias_name);
if (b == nullptr) {
if (b == NULL) {
cvm::error("Error: bias not found: " + bias_name);
return COLVARS_ERROR;
}
@ -647,7 +647,7 @@ std::string colvarmodule::read_colvar(std::string const &name)
colvar *c;
std::stringstream ss;
c = colvar_by_name(name);
if (c == nullptr) {
if (c == NULL) {
cvm::error("Error: colvar not found: " + name);
return std::string();
}
@ -663,7 +663,7 @@ cvm::real colvarmodule::energy_difference(std::string const &bias_name,
colvarbias *b;
cvm::real energy_diff = 0.;
b = bias_by_name(bias_name);
if (b == nullptr) {
if (b == NULL) {
cvm::error("Error: bias not found: " + bias_name);
return 0.;
}
@ -678,7 +678,7 @@ int colvarmodule::bias_current_bin(std::string const &bias_name)
int ret;
colvarbias *b = bias_by_name(bias_name);
if (b != nullptr) {
if (b != NULL) {
ret = b->current_bin();
} else {
cvm::error("Error: bias not found.\n");
@ -695,7 +695,7 @@ int colvarmodule::bias_bin_num(std::string const &bias_name)
int ret;
colvarbias *b = bias_by_name(bias_name);
if (b != nullptr) {
if (b != NULL) {
ret = b->bin_num();
} else {
cvm::error("Error: bias not found.\n");
@ -712,7 +712,7 @@ int colvarmodule::bias_bin_count(std::string const &bias_name, size_t bin_index)
int ret;
colvarbias *b = bias_by_name(bias_name);
if (b != nullptr) {
if (b != NULL) {
ret = b->bin_count(bin_index);
} else {
cvm::error("Error: bias not found.\n");
@ -729,7 +729,7 @@ int colvarmodule::bias_share(std::string const &bias_name)
int ret;
colvarbias *b = bias_by_name(bias_name);
if (b != nullptr) {
if (b != NULL) {
b->replica_share();
ret = COLVARS_OK;
} else {
@ -1037,7 +1037,7 @@ int colvarmodule::write_restart_file(std::string const &out_name)
int colvarmodule::write_traj_files()
{
if (cv_traj_os == nullptr) {
if (cv_traj_os == NULL) {
if (open_traj_file(cv_traj_name) != COLVARS_OK) {
return cvm::get_error();
} else {
@ -1057,7 +1057,7 @@ int colvarmodule::write_traj_files()
write_traj(*cv_traj_os);
}
if (restart_out_freq && (cv_traj_os != nullptr)) {
if (restart_out_freq && (cv_traj_os != NULL)) {
// flush the trajectory file if we are at the restart frequency
if ( (cvm::step_relative() > 0) &&
((cvm::step_absolute() % restart_out_freq) == 0) ) {
@ -1151,8 +1151,8 @@ colvarmodule::~colvarmodule()
atom_group::delete_features();
delete parse;
parse = nullptr;
proxy = nullptr;
parse = NULL;
proxy = NULL;
}
}
@ -1184,7 +1184,7 @@ int colvarmodule::reset()
proxy->reset();
if (cv_traj_os != nullptr) {
if (cv_traj_os != NULL) {
// Do not close traj file here, as we might not be done with it yet.
proxy->flush_output_stream(cv_traj_os);
}
@ -1395,7 +1395,7 @@ std::istream & colvarmodule::read_objects_state(std::istream &is)
if (static_cast<size_t>(is.tellg()) == pos) {
// This block has not been read by any object: discard it and move on
// to the next one
is >> colvarparse::read_block(word, nullptr);
is >> colvarparse::read_block(word, NULL);
}
if (!is) break;
@ -1456,7 +1456,7 @@ int colvarmodule::write_output_files()
}
cvm::decrease_depth();
if (cv_traj_os != nullptr) {
if (cv_traj_os != NULL) {
// do not close, there may be another run command
proxy->flush_output_stream(cv_traj_os);
}
@ -1575,7 +1575,7 @@ std::ostream & colvarmodule::write_restart(std::ostream &os)
int colvarmodule::open_traj_file(std::string const &file_name)
{
if (cv_traj_os != nullptr) {
if (cv_traj_os != NULL) {
return COLVARS_OK;
}
@ -1591,7 +1591,7 @@ int colvarmodule::open_traj_file(std::string const &file_name)
cv_traj_os = (cvm::proxy)->output_stream(file_name);
}
if (cv_traj_os == nullptr) {
if (cv_traj_os == NULL) {
cvm::error("Error: cannot write to file \""+file_name+"\".\n",
FILE_ERROR);
}
@ -1602,9 +1602,9 @@ int colvarmodule::open_traj_file(std::string const &file_name)
int colvarmodule::close_traj_file()
{
if (cv_traj_os != nullptr) {
if (cv_traj_os != NULL) {
proxy->close_output_stream(cv_traj_name);
cv_traj_os = nullptr;
cv_traj_os = NULL;
}
return cvm::get_error();
}
@ -1672,7 +1672,7 @@ void cvm::log(std::string const &message, int min_log_level)
{
if (cvm::log_level() < min_log_level) return;
// allow logging when the module is not fully initialized
size_t const d = (cvm::main() != nullptr) ? depth() : 0;
size_t const d = (cvm::main() != NULL) ? depth() : 0;
if (d > 0) {
proxy->log((std::string(2*d, ' '))+message);
} else {
@ -1780,7 +1780,7 @@ int cvm::read_index_file(char const *filename)
}
if (index_of_group < 0) {
index_group_names.push_back(group_name);
index_groups.push_back(nullptr);
index_groups.push_back(NULL);
index_of_group = index_groups.size()-1;
}
} else {
@ -1799,7 +1799,7 @@ int cvm::read_index_file(char const *filename)
pos = is.tellg();
}
if (old_index_group != nullptr) {
if (old_index_group != NULL) {
bool equal = false;
if (new_index_group->size() == old_index_group->size()) {
if (std::equal(new_index_group->begin(), new_index_group->end(),
@ -1810,13 +1810,13 @@ int cvm::read_index_file(char const *filename)
if (! equal) {
new_index_group->clear();
delete new_index_group;
new_index_group = nullptr;
new_index_group = NULL;
return cvm::error("Error: the index group \""+group_name+
"\" was redefined.\n", INPUT_ERROR);
} else {
old_index_group->clear();
delete old_index_group;
old_index_group = nullptr;
old_index_group = NULL;
}
}
@ -1850,7 +1850,7 @@ int colvarmodule::reset_index_groups()
size_t i = 0;
for ( ; i < index_groups.size(); i++) {
delete index_groups[i];
index_groups[i] = nullptr;
index_groups[i] = NULL;
}
index_group_names.clear();
index_groups.clear();
@ -2179,7 +2179,7 @@ std::string cvm::wrap_string(std::string const &s, size_t nchars)
// shared pointer to the proxy object
colvarproxy *colvarmodule::proxy = nullptr;
colvarproxy *colvarmodule::proxy = NULL;
// static runtime data
cvm::real colvarmodule::debug_gradients_step_size = 1.0e-07;

View File

@ -459,13 +459,13 @@ public:
/// Backup a file before writing it
static int backup_file(char const *filename);
/// Look up a bias by name; returns nullptr if not found
/// Look up a bias by name; returns NULL if not found
static colvarbias * bias_by_name(std::string const &name);
/// Look up a colvar by name; returns nullptr if not found
/// Look up a colvar by name; returns NULL if not found
static colvar * colvar_by_name(std::string const &name);
/// Look up a named atom group by name; returns nullptr if not found
/// Look up a named atom group by name; returns NULL if not found
static atom_group * atom_group_by_name(std::string const &name);
/// Load new configuration for the given bias -

View File

@ -76,7 +76,7 @@ void const *colvarparams::get_param_ptr(std::string const &param_name)
return param_map[param_name];
}
cvm::error("Error: parameter \""+param_name+"\" not found.\n", INPUT_ERROR);
return nullptr;
return NULL;
}
@ -87,7 +87,7 @@ void const *colvarparams::get_param_grad_ptr(std::string const &param_name)
}
cvm::error("Error: gradient of parameter \""+param_name+"\" not found.\n",
INPUT_ERROR);
return nullptr;
return NULL;
}
@ -95,7 +95,7 @@ cvm::real colvarparams::get_param(std::string const &param_name)
{
cvm::real const *ptr =
reinterpret_cast<cvm::real const *>(get_param_ptr(param_name));
return ptr != nullptr ? *ptr : 0.0;
return ptr != NULL ? *ptr : 0.0;
}

View File

@ -674,12 +674,12 @@ bool colvarparse::key_lookup(std::string const &conf,
std::string const conf_lower(to_lower_cppstr(conf));
// by default, there is no value, unless we found one
if (data != nullptr) {
if (data != NULL) {
data->clear();
}
// start from the first occurrence of key
size_t pos = conf_lower.find(key, (save_pos != nullptr) ? *save_pos : 0);
size_t pos = conf_lower.find(key, (save_pos != NULL) ? *save_pos : 0);
// iterate over all instances of the substring until it finds it as isolated keyword
while (true) {
@ -727,7 +727,7 @@ bool colvarparse::key_lookup(std::string const &conf,
}
}
if (save_pos != nullptr) {
if (save_pos != NULL) {
// save the pointer for a future call (when iterating over multiple
// valid instances of the same keyword)
*save_pos = pos + key.size();
@ -820,7 +820,7 @@ bool colvarparse::key_lookup(std::string const &conf,
data_end) + 1;
}
if (data != nullptr) {
if (data != NULL) {
data->append(line, data_begin, (data_end-data_begin));
if (cvm::debug()) {
@ -834,7 +834,7 @@ bool colvarparse::key_lookup(std::string const &conf,
}
}
if (save_pos != nullptr) *save_pos = line_end;
if (save_pos != NULL) *save_pos = line_end;
return true;
}

View File

@ -275,12 +275,12 @@ public:
/// The keyword that identifies the block
std::string const key;
/// Where to keep the data (may be nullptr)
/// Where to keep the data (may be NULL)
std::string * const data;
public:
read_block(std::string const &key_in, std::string *data_in = nullptr);
read_block(std::string const &key_in, std::string *data_in = NULL);
~read_block();
@ -300,8 +300,8 @@ public:
/// within "conf", useful when doing multiple calls
bool key_lookup(std::string const &conf,
char const *key,
std::string *data = nullptr,
size_t *save_pos = nullptr);
std::string *data = NULL,
size_t *save_pos = NULL);
/// \brief Reads a configuration line, adds it to config_string, and returns
/// the stream \param is Input stream \param line String that will hold the

View File

@ -296,7 +296,7 @@ void colvarproxy_atom_groups::clear_atom_group(int index)
colvarproxy_smp::colvarproxy_smp()
{
b_smp_active = true; // May be disabled by user option
omp_lock_state = nullptr;
omp_lock_state = NULL;
#if defined(_OPENMP)
if (smp_thread_id() == 0) {
omp_lock_state = reinterpret_cast<void *>(new omp_lock_t);
@ -459,7 +459,7 @@ int colvarproxy_smp::smp_unlock()
colvarproxy_script::colvarproxy_script()
{
script = nullptr;
script = NULL;
}
@ -507,7 +507,7 @@ int colvarproxy_script::run_colvar_gradient_callback(std::string const & /* name
colvarproxy_tcl::colvarproxy_tcl()
{
tcl_interp_ = nullptr;
tcl_interp_ = NULL;
}
@ -528,7 +528,7 @@ char const *colvarproxy_tcl::tcl_obj_to_str(unsigned char *obj)
#if defined(COLVARS_TCL)
return Tcl_GetString(reinterpret_cast<Tcl_Obj *>(obj));
#else
return nullptr;
return NULL;
#endif
}
@ -666,7 +666,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name,
}
std::ostream *os = get_output_stream(output_name);
if (os != nullptr) return os;
if (os != NULL) return os;
if (!(mode & (std::ios_base::app | std::ios_base::ate))) {
backup_file(output_name);
@ -675,7 +675,7 @@ std::ostream * colvarproxy_io::output_stream(std::string const &output_name,
if (!osf->is_open()) {
cvm::error("Error: cannot write to file/channel \""+output_name+"\".\n",
FILE_ERROR);
return nullptr;
return NULL;
}
output_stream_names.push_back(output_name);
output_files.push_back(osf);
@ -692,7 +692,7 @@ std::ostream *colvarproxy_io::get_output_stream(std::string const &output_name)
return *osi;
}
}
return nullptr;
return NULL;
}
@ -794,7 +794,7 @@ int colvarproxy_io::rename_file(char const *filename, char const *newfilename)
colvarproxy::colvarproxy()
{
colvars = nullptr;
colvars = NULL;
b_simulation_running = true;
b_delete_requested = false;
}

View File

@ -607,7 +607,7 @@ public:
std::ios_base::openmode mode =
std::ios_base::out);
/// Returns a reference to output_name if it exists, nullptr otherwise
/// Returns a reference to output_name if it exists, NULL otherwise
virtual std::ostream *get_output_stream(std::string const &output_name);
/// \brief Flushes the given output channel

View File

@ -97,7 +97,7 @@ int colvarscript::run(int objc, unsigned char *const objv[])
}
std::string const name(obj_to_str(objv[2]));
colvar *cv = cvm::colvar_by_name(name);
if (cv == nullptr) {
if (cv == NULL) {
result = "Colvar not found: " + name;
return COLVARSCRIPT_ERROR;
}
@ -111,7 +111,7 @@ int colvarscript::run(int objc, unsigned char *const objv[])
}
std::string const name(obj_to_str(objv[2]));
colvarbias *b = cvm::bias_by_name(name);
if (b == nullptr) {
if (b == NULL) {
result = "Bias not found: " + name;
return COLVARSCRIPT_ERROR;
}
@ -186,7 +186,7 @@ int colvarscript::run(int objc, unsigned char *const objv[])
/// Parse config from string
if (cmd == "config") {
return exec_command(cv_config, nullptr, objc, objv);
return exec_command(cv_config, NULL, objc, objv);
}
/// Load an input state file
@ -247,7 +247,7 @@ int colvarscript::run(int objc, unsigned char *const objv[])
} else if (objc == 3) {
// Failure of this function does not trigger an error, but
// returns nonzero, to let scripts detect available frames
int error = proxy->set_frame(strtol(obj_to_str(objv[2]), nullptr, 10));
int error = proxy->set_frame(strtol(obj_to_str(objv[2]), NULL, 10));
result = cvm::to_str(error == COLVARS_OK ? 0 : -1);
return COLVARS_OK;
} else {
@ -258,7 +258,7 @@ int colvarscript::run(int objc, unsigned char *const objv[])
if (cmd == "addenergy") {
if (objc == 3) {
colvars->total_bias_energy += strtod(obj_to_str(objv[2]), nullptr);
colvars->total_bias_energy += strtod(obj_to_str(objv[2]), NULL);
return COLVARS_OK;
} else {
result = "Wrong arguments to command \"addenergy\"\n" + help_string();
@ -267,7 +267,7 @@ int colvarscript::run(int objc, unsigned char *const objv[])
}
if (cmd == "help") {
return exec_command(cv_help, nullptr, objc, objv);
return exec_command(cv_help, NULL, objc, objv);
}
result = "Syntax error\n" + help_string();
@ -320,7 +320,7 @@ int colvarscript::proc_colvar(colvar *cv, int objc, unsigned char *const objv[])
// colvar destructor is tasked with the cleanup
delete cv;
// TODO this could be done by the destructors
if (colvars->cv_traj_os != nullptr) {
if (colvars->cv_traj_os != NULL) {
colvars->write_traj_label(*(colvars->cv_traj_os));
}
return COLVARS_OK;
@ -513,7 +513,7 @@ int colvarscript::proc_bias(colvarbias *b, int objc, unsigned char *const objv[]
// the bias destructor takes care of the cleanup at cvm level
delete b;
// TODO this could be done by the destructors
if (colvars->cv_traj_os != nullptr) {
if (colvars->cv_traj_os != NULL) {
colvars->write_traj_label(*(colvars->cv_traj_os));
}
return COLVARS_OK;
@ -564,7 +564,7 @@ int colvarscript::proc_features(colvardeps *obj,
if ((subcmd == "get") || (subcmd == "set")) {
std::vector<colvardeps::feature *> const &features = obj->features();
std::string const req_feature(obj_to_str(objv[3]));
colvardeps::feature *f = nullptr;
colvardeps::feature *f = NULL;
int fid = 0;
for (fid = 0; fid < int(features.size()); fid++) {
if (features[fid]->description ==
@ -574,7 +574,7 @@ int colvarscript::proc_features(colvardeps *obj,
}
}
if (f == nullptr) {
if (f == NULL) {
result = "Error: feature \""+req_feature+"\" does not exist.\n";
return COLVARSCRIPT_ERROR;

View File

@ -278,7 +278,7 @@ extern "C" {
1, 1,
{ "E (float) - Amount of energy to add" },
cvm::main()->total_bias_energy +=
strtod(script->obj_to_str(objv[2]), nullptr);
strtod(script->obj_to_str(objv[2]), NULL);
return COLVARS_OK;
)

View File

@ -59,7 +59,7 @@ public:
if (data.size() > 0) {
return &(data[0]);
} else {
return nullptr;
return NULL;
}
}
@ -520,7 +520,7 @@ public:
if (rows.size() > 0) {
return &(pointers[0]);
} else {
return nullptr;
return NULL;
}
}

View File

@ -186,7 +186,7 @@ public:
}
bool operator!=(const Operation& op) const {
const Constant* o = dynamic_cast<const Constant*>(&op);
return (o == nullptr || o->value != value);
return (o == NULL || o->value != value);
}
private:
double value;
@ -217,7 +217,7 @@ public:
ExpressionTreeNode differentiate(const std::vector<ExpressionTreeNode>& children, const std::vector<ExpressionTreeNode>& childDerivs, const std::string& variable) const;
bool operator!=(const Operation& op) const {
const Variable* o = dynamic_cast<const Variable*>(&op);
return (o == nullptr || o->name != name);
return (o == NULL || o->name != name);
}
private:
std::string name;
@ -264,7 +264,7 @@ public:
}
bool operator!=(const Operation& op) const {
const Custom* o = dynamic_cast<const Custom*>(&op);
return (o == nullptr || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder);
return (o == NULL || o->name != name || o->isDerivative != isDerivative || o->derivOrder != derivOrder);
}
private:
std::string name;
@ -955,7 +955,7 @@ public:
}
bool operator!=(const Operation& op) const {
const AddConstant* o = dynamic_cast<const AddConstant*>(&op);
return (o == nullptr || o->value != value);
return (o == NULL || o->value != value);
}
private:
double value;
@ -988,7 +988,7 @@ public:
}
bool operator!=(const Operation& op) const {
const MultiplyConstant* o = dynamic_cast<const MultiplyConstant*>(&op);
return (o == nullptr || o->value != value);
return (o == NULL || o->value != value);
}
private:
double value;
@ -1042,7 +1042,7 @@ public:
}
bool operator!=(const Operation& op) const {
const PowerConstant* o = dynamic_cast<const PowerConstant*>(&op);
return (o == nullptr || o->value != value);
return (o == NULL || o->value != value);
}
bool isInfixOperator() const {
return true;

View File

@ -40,10 +40,10 @@ using namespace std;
using namespace asmjit;
#endif
CompiledExpression::CompiledExpression() : jitCode(nullptr) {
CompiledExpression::CompiledExpression() : jitCode(NULL) {
}
CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(nullptr) {
CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jitCode(NULL) {
ParsedExpression expr = expression.optimize(); // Just in case it wasn't already optimized.
vector<pair<ExpressionTreeNode, int> > temps;
compileExpression(expr.getRootNode(), temps);
@ -59,11 +59,11 @@ CompiledExpression::CompiledExpression(const ParsedExpression& expression) : jit
CompiledExpression::~CompiledExpression() {
for (int i = 0; i < (int) operation.size(); i++)
if (operation[i] != nullptr)
if (operation[i] != NULL)
delete operation[i];
}
CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(nullptr) {
CompiledExpression::CompiledExpression(const CompiledExpression& expression) : jitCode(NULL) {
*this = expression;
}

View File

@ -59,14 +59,14 @@ ExpressionTreeNode::ExpressionTreeNode(Operation* operation) : operation(operati
throw Exception("wrong number of arguments to function: "+operation->getName());
}
ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == nullptr ? nullptr : node.operation->clone()), children(node.getChildren()) {
ExpressionTreeNode::ExpressionTreeNode(const ExpressionTreeNode& node) : operation(node.operation == NULL ? NULL : node.operation->clone()), children(node.getChildren()) {
}
ExpressionTreeNode::ExpressionTreeNode() : operation(nullptr) {
ExpressionTreeNode::ExpressionTreeNode() : operation(NULL) {
}
ExpressionTreeNode::~ExpressionTreeNode() {
if (operation != nullptr)
if (operation != NULL)
delete operation;
}
@ -91,7 +91,7 @@ bool ExpressionTreeNode::operator==(const ExpressionTreeNode& node) const {
}
ExpressionTreeNode& ExpressionTreeNode::operator=(const ExpressionTreeNode& node) {
if (operation != nullptr)
if (operation != NULL)
delete operation;
operation = node.getOperation().clone();
children = node.getChildren();

View File

@ -46,7 +46,7 @@ ParsedExpression::ParsedExpression(const ExpressionTreeNode& rootNode) : rootNod
}
const ExpressionTreeNode& ParsedExpression::getRootNode() const {
if (&rootNode.getOperation() == nullptr)
if (&rootNode.getOperation() == NULL)
throw Exception("Illegal call to an initialized ParsedExpression");
return rootNode;
}

View File

@ -4,11 +4,11 @@ void* kokkos_test(void* args) { return args; }
int main(void) {
pthread_t thread;
/* Use nullptr to avoid C++11. Some compilers
/* Use NULL to avoid C++11. Some compilers
do not have C++11 by default. Forcing C++11
in the compile tests can be done, but is unnecessary
*/
pthread_create(&thread, nullptr, kokkos_test, nullptr);
pthread_join(thread, nullptr);
pthread_create(&thread, NULL, kokkos_test, NULL);
pthread_join(thread, NULL);
return 0;
}

View File

@ -640,7 +640,7 @@ void SharedAllocationRecord<Kokkos::Experimental::HIPSpace, void>::
/*--------------------------------------------------------------------------*/
void* hip_resize_scratch_space(size_t bytes, bool force_shrink) {
static void* ptr = nullptr;
static void* ptr = NULL;
static size_t current_size = 0;
if (current_size == 0) {
current_size = bytes;

View File

@ -139,7 +139,7 @@ void *HBWSpace::allocate(const char *arg_label, const size_t arg_alloc_size,
}
msg << " ]( " << arg_alloc_size << " ) FAILED";
if (ptr == nullptr) {
msg << " NULL";
msg << " nullptr";
} else {
msg << " NOT ALIGNED " << ptr;
}

View File

@ -215,7 +215,7 @@ SharedAllocationRecord<void, void>::SharedAllocationRecord(
} else {
Kokkos::Impl::throw_runtime_exception(
"Kokkos::Impl::SharedAllocationRecord given NULL allocation");
"Kokkos::Impl::SharedAllocationRecord given nullptr allocation");
}
}

View File

@ -13,7 +13,7 @@ int setenv(const char *name, const char *value, int overwrite) {
int errcode = 0;
if (!overwrite) {
size_t envsize = 0;
errcode = getenv_s(&envsize, nullptr, 0, name);
errcode = getenv_s(&envsize, NULL, 0, name);
if (errcode || envsize) return errcode;
}
return _putenv_s(name, value);