Browse Source

[ospfd] Make OSPF_ISM_TIMER_OFF macro safer.
2005-11-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>

* ospf_ism.h: (OSPF_ISM_TIMER_OFF) Improve macro syntax by enclosing
in 'do {...} while(0)'.

ajs 13 years ago
parent
commit
70cd34749f
2 changed files with 12 additions and 5 deletions
  1. 5 0
      ospfd/ChangeLog
  2. 7 5
      ospfd/ospf_ism.h

+ 5 - 0
ospfd/ChangeLog

@@ -1,3 +1,8 @@
+2005-11-16 Andrew J. Schorr <ajschorr@alumni.princeton.edu>
+
+	* ospf_ism.h: (OSPF_ISM_TIMER_OFF) Improve macro syntax by enclosing
+	  in 'do {...} while(0)'.
+
 2005-11-14 Paul Jakma <paul.jakma@sun.com>
 
 	* ospfd.c: (ospf_new) stub-shutdown should just default to

+ 7 - 5
ospfd/ospf_ism.h

@@ -90,11 +90,13 @@
 
 /* Macro for OSPF ISM timer turn off. */
 #define OSPF_ISM_TIMER_OFF(X) \
-      if (X) \
-        { \
-          thread_cancel (X); \
-          (X) = NULL; \
-        }
+  do { \
+    if (X) \
+      { \
+	thread_cancel (X); \
+	(X) = NULL; \
+      } \
+  } while (0)
 
 /* Macro for OSPF schedule event. */
 #define OSPF_ISM_EVENT_SCHEDULE(I,E) \