Tidy: modernize-use-nullptr
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / xlate.cpp
index c89244bff66cf17426997fe353a0bfa41aad60fe..760fd0c1d73ecbcc42f018a386483f02b5dfff46 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,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.
@@ -98,11 +98,11 @@ static void get_xlatoms(const char *fn, FILE *fp,
         }
         else
         {
-            xl[n].res = NULL;
+            xl[n].res = nullptr;
         }
 
         /* Replace underscores in the string by spaces */
-        while ((_ptr = strchr(abuf, '_')) != 0)
+        while ((_ptr = strchr(abuf, '_')) != nullptr)
         {
             *_ptr = ' ';
         }
@@ -123,7 +123,7 @@ static void done_xlatom(int nxlate, t_xlate_atom *xlatom)
     for (i = 0; (i < nxlate); i++)
     {
         sfree(xlatom[i].filebase);
-        if (xlatom[i].res != NULL)
+        if (xlatom[i].res != nullptr)
         {
             sfree(xlatom[i].res);
         }
@@ -148,8 +148,8 @@ void rename_atoms(const char *xlfile, const char *ffdir,
     gmx_bool      bStartTerm, bEndTerm;
 
     nxlate = 0;
-    xlatom = NULL;
-    if (xlfile != NULL)
+    xlatom = nullptr;
+    if (xlfile != nullptr)
     {
         fp = libopen(xlfile);
         get_xlatoms(xlfile, fp, &nxlate, &xlatom);
@@ -203,11 +203,11 @@ void rename_atoms(const char *xlfile, const char *ffdir,
         for (i = 0; (i < nxlate) && !bRenamed; i++)
         {
             /* Check if the base file name of the rtp and arn entry match */
-            if (restp == NULL ||
+            if (restp == nullptr ||
                 gmx_strcasecmp(restp[resind].filebase, xlatom[i].filebase) == 0)
             {
                 /* Match the residue name */
-                bMatch = (xlatom[i].res == NULL ||
+                bMatch = (xlatom[i].res == nullptr ||
                           (gmx_strcasecmp("protein-nterm", xlatom[i].res) == 0 &&
                            gmx_residuetype_is_protein(rt, rnm) && bStartTerm) ||
                           (gmx_strcasecmp("protein-cterm", xlatom[i].res) == 0 &&