Sort all includes in src/gromacs
[alexxy/gromacs.git] / src / gromacs / gmxpreprocess / gmxcpp.c
index 87361b352691d4bba8670a9163389232863ee200..42fd453757e26f6897498a16f21ce5413cf92261 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
-#include "config.h"
+#include "gmxpre.h"
 
-#include <sys/types.h>
+#include "gmxcpp.h"
+
+#include <ctype.h>
+#include <errno.h>
+#include <limits.h>
+#include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <math.h>
 #include <string.h>
-#include <errno.h>
-#include <limits.h>
-#include <ctype.h>
 
+#include <sys/types.h>
+
+#include "gromacs/legacyheaders/macros.h"
 #include "gromacs/utility/cstringutil.h"
-#include "gromacs/utility/smalloc.h"
-#include "gromacs/utility/futil.h"
-#include "macros.h"
 #include "gromacs/utility/fatalerror.h"
-#include "gmxcpp.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/utility/smalloc.h"
 
 typedef struct {
     char *name;
@@ -167,7 +169,7 @@ static void add_include(const char *include)
     {
         nincl++;
         srenew(incl, nincl);
-        incl[nincl-1] = strdup(include);
+        incl[nincl-1] = gmx_strdup(include);
     }
 }
 
@@ -199,7 +201,7 @@ static void add_define(const char *name, const char *value)
         ndef++;
         srenew(defs, ndef);
         i            = ndef - 1;
-        defs[i].name = strdup(name);
+        defs[i].name = gmx_strdup(name);
     }
     else if (defs[i].def)
     {
@@ -211,7 +213,7 @@ static void add_define(const char *name, const char *value)
     }
     if (value && strlen(value) > 0)
     {
-        defs[i].def  = strdup(value);
+        defs[i].def  = gmx_strdup(value);
     }
     else
     {
@@ -282,7 +284,7 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts)
     /* Find the file. First check whether it is in the current directory. */
     if (gmx_fexist(filenm))
     {
-        cpp->fn = strdup(filenm);
+        cpp->fn = gmx_strdup(filenm);
     }
     else
     {
@@ -332,7 +334,7 @@ int cpp_open_file(const char *filenm, gmx_cpp_t *handle, char **cppopts)
     {
         cpp->path = cpp->fn;
         *ptr      = '\0';
-        cpp->fn   = strdup(ptr+1);
+        cpp->fn   = gmx_strdup(ptr+1);
         snew(cpp->cwd, STRLEN);
 
         gmx_getcwd(cpp->cwd, STRLEN);
@@ -807,5 +809,5 @@ char *cpp_error(gmx_cpp_t *handlep, int status)
             (handle) ? handle->line_nr : -1,
             handle->line ? handle->line : "");
 
-    return strdup(buf);
+    return gmx_strdup(buf);
 }