/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
const char *
_gmx_selelem_type_str(const gmx::SelectionTreeElement &sel)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (sel.type)
{
case SEL_CONST: p = "CONST"; break;
const char *
_gmx_sel_value_type_str(const gmx_ana_selvalue_t *val)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (val->type)
{
case NO_VALUE: p = "NONE"; break;
const char *
_gmx_selelem_boolean_type_str(const gmx::SelectionTreeElement &sel)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (sel.u.boolt)
{
case BOOL_NOT: p = "NOT"; break;
}
_gmx_selvalue_clear(&this->v);
std::memset(&this->u, 0, sizeof(this->u));
- this->evaluate = NULL;
- this->mempool = NULL;
- this->cdata = NULL;
+ this->evaluate = nullptr;
+ this->mempool = nullptr;
+ this->cdata = nullptr;
}
SelectionTreeElement::~SelectionTreeElement()
}
}
_gmx_selvalue_free(&v);
- if (type == SEL_SUBEXPRREF && u.param != NULL)
+ if (type == SEL_SUBEXPRREF && u.param != nullptr)
{
// TODO: This is now called from two different locations.
// It is likely that one of them is unnecessary, but that requires
if (type == SEL_EXPRESSION || type == SEL_MODIFIER)
{
_gmx_selelem_free_method(u.expr.method, u.expr.mdata);
- u.expr.mdata = NULL;
- u.expr.method = NULL;
+ u.expr.mdata = nullptr;
+ u.expr.method = nullptr;
/* Free position data */
delete u.expr.pos;
- u.expr.pos = NULL;
+ u.expr.pos = nullptr;
/* Free position calculation data */
if (u.expr.pc)
{
gmx_ana_poscalc_free(u.expr.pc);
- u.expr.pc = NULL;
+ u.expr.pc = nullptr;
}
}
if (type == SEL_ARITHMETIC)
{
sfree(u.arith.opstr);
- u.arith.opstr = NULL;
+ u.arith.opstr = nullptr;
}
if (type == SEL_SUBEXPR || type == SEL_ROOT
|| (type == SEL_CONST && v.type == GROUP_VALUE))
case INT_VALUE:
case REAL_VALUE:
_gmx_sel_mempool_free(mempool, v.u.ptr);
- _gmx_selvalue_setstore(&v, NULL);
+ _gmx_selvalue_setstore(&v, nullptr);
break;
case GROUP_VALUE:
{
GMX_RELEASE_ASSERT(type == SEL_GROUPREF,
"Should only be called for index group reference elements");
- if (grps == NULL)
+ if (grps == nullptr)
{
std::string message = formatString(
"Cannot match '%s', because index groups are not available.",
gmx_ana_index_t foundGroup;
std::string foundName;
- if (u.gref.name != NULL)
+ if (u.gref.name != nullptr)
{
if (!gmx_ana_indexgrps_find(&foundGroup, &foundName, grps, u.gref.name))
{
void
_gmx_selelem_free_param(gmx_ana_selparam_t *param)
{
- if (param->val.u.ptr != NULL)
+ if (param->val.u.ptr != nullptr)
{
if (param->val.type == GROUP_VALUE)
{
void
_gmx_selelem_free_method(gmx_ana_selmethod_t *method, void *mdata)
{
- sel_freefunc free_func = NULL;
+ sel_freefunc free_func = nullptr;
/* Save the pointer to the free function. */
if (method && method->free)
if ((sel.type == SEL_CONST && sel.v.type == GROUP_VALUE) || sel.type == SEL_ROOT)
{
const gmx_ana_index_t *g = sel.v.u.g;
- if (!g || g->isize == 0 || sel.evaluate != NULL)
+ if (!g || g->isize == 0 || sel.evaluate != nullptr)
{
g = &sel.u.cgrp;
}
fprintf(fp, "\n");
}
}
- else if (sel.type == SEL_SUBEXPRREF && sel.u.param != NULL)
+ else if (sel.type == SEL_SUBEXPRREF && sel.u.param != nullptr)
{
fprintf(fp, "%*c param", level*2+1, ' ');
- if (sel.u.param->name != NULL)
+ if (sel.u.param->name != nullptr)
{
fprintf(fp, " \"%s\"", sel.u.param->name);
}