:78 Function create_function() is deprecated [8192]

made macros and ternary operators better

Ramses van Zon [2018-03-27 22:49:55]
made macros and ternary operators better
Filename
global.h
mpicommunication.c
pardy.c
diff --git a/global.h b/global.h
index 8871bf5..7e41b6b 100644
--- a/global.h
+++ b/global.h
@@ -14,7 +14,7 @@ typedef signed char tiny_int;
 */
 static inline double max3(double x1, double x2, double x3)
 {
-    double m12 = (x1>x2) ? x1 : x2;
-    return (m12>x3) ? m12 : x3;
+    double m12 = ((x1>x2) ? x1 : x2);
+    return ((m12>x3) ? m12 : x3);
 }
 #endif
diff --git a/mpicommunication.c b/mpicommunication.c
index ebb4dfa..78165c0 100644
--- a/mpicommunication.c
+++ b/mpicommunication.c
@@ -15,8 +15,8 @@ static double periodic(double u, double L)
     return u;
 }

-#define include13(x)            ((x)>=13)?(x)-1:(x)
-#define skip13(x)               ((x)>=13)?(x)+1:(x)
+#define include13(x)            (((x)>=13)?(x)-1:(x))
+#define skip13(x)               (((x)>=13)?(x)+1:(x))
 #define SEND_CELL_TO(direction) do{int so=include13(direction);if(!sys->neighborsendblock[direction]){assert_lt(blockcount[so],maxsendcells);work->blockinit[so][blockcount[so]]=sys->start_of_cell[c];work->blocklens[so][blockcount[so]]=sys->n_in_cell[c];blockcount[so]++;}}while(false)

 void detect_and_send_ghost_particles(atom_t* atoms, size_t bufmax,
diff --git a/pardy.c b/pardy.c
index 31efe32..aaefb9b 100644
--- a/pardy.c
+++ b/pardy.c
@@ -299,7 +299,7 @@ int main(int argc, char* argv[])
     /**/
     system_t sys;
     if (i_am_root) {
-        FILE* file = (argc>1)?fopen(argv[1],"r"):stdin;
+        FILE* file = ((argc>1)?fopen(argv[1],"r"):stdin);
         if (file == NULL)
             MPI_Abort(MPI_COMM_WORLD, 1);
         key_value_table_t* ini = calloc(1,sizeof(*ini));
ViewGit