Localize the timeout variable within the W message macro.
[vpp.git] / src / vlibapi / vat_helper_macros.h
index b2fbb86..ffb74fe 100644 (file)
@@ -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) {           \