Tidy: modernize-use-nullptr
[alexxy/gromacs.git] / src / gromacs / fileio / confio.cpp
index 7735957498427c434613cdfc4ffe885eeab2c416..9888e6407a0929c6dc881b9a51c83c94a760abe6 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,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
@@ -103,7 +103,7 @@ void write_sto_conf_indexed(const char *outfile, const char *title,
         case efENT:
         case efPQR:
             out = gmx_fio_fopen(outfile, "w");
-            write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, NULL, TRUE);
+            write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, nullptr, TRUE);
             gmx_fio_fclose(out);
             break;
         case efESP:
@@ -149,19 +149,19 @@ void write_sto_conf(const char *outfile, const char *title, const t_atoms *atoms
             fr.bBox = TRUE;
             copy_mat(box, fr.box);
             out = gmx_fio_fopen(outfile, "w");
-            write_g96_conf(out, &fr, -1, NULL);
+            write_g96_conf(out, &fr, -1, nullptr);
             gmx_fio_fclose(out);
             break;
         case efPDB:
         case efBRK:
         case efENT:
             out = gmx_fio_fopen(outfile, "w");
-            write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, NULL, TRUE);
+            write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, nullptr, TRUE);
             gmx_fio_fclose(out);
             break;
         case efESP:
             out = gmx_fio_fopen(outfile, "w");
-            write_espresso_conf_indexed(out, title, atoms, atoms->nr, NULL, x, v, box);
+            write_espresso_conf_indexed(out, title, atoms, atoms->nr, nullptr, x, v, box);
             gmx_fio_fclose(out);
             break;
         case efTPR:
@@ -218,13 +218,13 @@ static void get_stx_coordnum(const char *infile, int *natoms)
         case efG96:
         {
             in        = gmx_fio_fopen(infile, "r");
-            fr.title  = NULL;
+            fr.title  = nullptr;
             fr.natoms = -1;
-            fr.atoms  = NULL;
-            fr.x      = NULL;
-            fr.v      = NULL;
-            fr.f      = NULL;
-            *natoms   = read_g96_conf(in, infile, &fr, NULL, g96_line);
+            fr.atoms  = nullptr;
+            fr.x      = nullptr;
+            fr.v      = nullptr;
+            fr.f      = nullptr;
+            *natoms   = read_g96_conf(in, infile, &fr, nullptr, g96_line);
             sfree(const_cast<char *>(fr.title));
             gmx_fio_fclose(in);
             break;
@@ -317,7 +317,7 @@ static void read_stx_conf(const char *infile,
     {
         fprintf(stderr, "Warning: Number of atoms in %s is 0\n", infile);
     }
-    else if (atoms->atom == NULL)
+    else if (atoms->atom == nullptr)
     {
         gmx_mem("Uninitialized array atom");
     }
@@ -334,12 +334,12 @@ static void read_stx_conf(const char *infile,
             gmx_gro_read_conf(infile, symtab, name, atoms, x, v, box);
             break;
         case efG96:
-            fr.title  = NULL;
+            fr.title  = nullptr;
             fr.natoms = atoms->nr;
             fr.atoms  = atoms;
             fr.x      = x;
             fr.v      = v;
-            fr.f      = NULL;
+            fr.f      = nullptr;
             in        = gmx_fio_fopen(infile, "r");
             read_g96_conf(in, infile, &fr, symtab, g96_line);
             gmx_fio_fclose(in);
@@ -371,7 +371,7 @@ static void readConfAndAtoms(const char *infile,
     init_t_atoms(atoms, natoms, (fn2ftp(infile) == efPDB));
 
     bool xIsNull = false;
-    if (x == NULL)
+    if (x == nullptr)
     {
         snew(x, 1);
         xIsNull = true;
@@ -383,7 +383,7 @@ static void readConfAndAtoms(const char *infile,
     }
     read_stx_conf(infile,
                   symtab, name, atoms,
-                  *x, (v == NULL) ? NULL : *v, ePBC, box);
+                  *x, (v == nullptr) ? nullptr : *v, ePBC, box);
     if (xIsNull)
     {
         sfree(*x);
@@ -396,9 +396,9 @@ void readConfAndTopology(const char *infile,
                          int *ePBC,
                          rvec **x, rvec **v, matrix box)
 {
-    GMX_RELEASE_ASSERT(mtop != NULL, "readConfAndTopology requires mtop!=NULL");
+    GMX_RELEASE_ASSERT(mtop != nullptr, "readConfAndTopology requires mtop!=NULL");
 
-    if (ePBC != NULL)
+    if (ePBC != nullptr)
     {
         *ePBC = -1;
     }
@@ -418,9 +418,9 @@ void readConfAndTopology(const char *infile,
         }
         int natoms;
         int ePBC_tmp
-            = read_tpx(infile, NULL, box, &natoms,
-                       (x == NULL) ? NULL : *x, (v == NULL) ? NULL : *v, mtop);
-        if (ePBC != NULL)
+            = read_tpx(infile, nullptr, box, &natoms,
+                       (x == nullptr) ? nullptr : *x, (v == nullptr) ? nullptr : *v, mtop);
+        if (ePBC != nullptr)
         {
             *ePBC = ePBC_tmp;
         }