Localize the timeout variable within the W message macro.
[vpp.git] / src / vlibapi / vat_helper_macros.h
index dc91c9f..ffb74fe 100644 (file)
@@ -20,7 +20,7 @@
 #define __vat_helper_macros_h__
 
 /* M: construct, but don't yet send a message */
-#define M(T,t)                                                  \
+#define M(T, mp)                                                \
 do {                                                            \
     vam->result_ready = 0;                                      \
     mp = vl_msg_api_alloc_as_if_client(sizeof(*mp));            \
@@ -29,7 +29,7 @@ do {                                                            \
     mp->client_index = vam->my_client_index;                    \
 } while(0);
 
-#define M2(T,t,n)                                               \
+#define M2(T, mp, n)                                            \
 do {                                                            \
     vam->result_ready = 0;                                      \
     mp = vl_msg_api_alloc_as_if_client(sizeof(*mp)+(n));        \
@@ -39,12 +39,12 @@ do {                                                            \
 } while(0);
 
 /* S: send a message */
-#define S (vl_msg_api_send_shmem (vam->vl_input_queue, (u8 *)&mp))
+#define S(mp) (vl_msg_api_send_shmem (vam->vl_input_queue, (u8 *)&mp))
 
 /* W: wait for results, with timeout */
 #define W                                       \
 do {                                            \
-    timeout = vat_time_now (vam) + 1.0;         \
+    f64 timeout = vat_time_now (vam) + 1.0;     \
                                                 \
     while (vat_time_now (vam) < timeout) {      \
         if (vam->result_ready == 1) {           \
@@ -58,7 +58,7 @@ do {                                            \
 /* W2: wait for results, with timeout */
 #define W2(body)                                \
 do {                                            \
-    timeout = vat_time_now (vam) + 1.0;         \
+    f64 timeout = vat_time_now (vam) + 1.0;     \
                                                 \
     while (vat_time_now (vam) < timeout) {      \
         if (vam->result_ready == 1) {           \