summaryrefslogtreecommitdiff
path: root/include/modules.h
diff options
context:
space:
mode:
authorNaram Qashat <cyberbotx@cyberbotx.com>2010-06-26 01:38:19 -0400
committerNaram Qashat <cyberbotx@cyberbotx.com>2010-06-26 01:38:19 -0400
commit6dc3af5db41ecb24669b259c776c51964539d531 (patch)
treee710d022742ad2bf0723c5806afd6a3cc091ba62 /include/modules.h
parente447933c02eac8013f84cb00751a8e1411ddb1b6 (diff)
The next of a few "CBX OCDing over code style" commits, focusing on src/core/hs_* and src/core/ms_*, plus some tiny fallout caused by changing the FOREACH_* macros.
Diffstat (limited to 'include/modules.h')
-rw-r--r--include/modules.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/include/modules.h b/include/modules.h
index 10e169dff..5fd36d6ac 100644
--- a/include/modules.h
+++ b/include/modules.h
@@ -55,8 +55,8 @@ enum EventReturn
* loaded modules in a readable simple way, e.g.:
* 'FOREACH_MOD(I_OnConnect,OnConnect(user));'
*/
-#define FOREACH_MOD(y,x) \
-do \
+#define FOREACH_MOD(y, x) \
+if (true) \
{ \
std::vector<Module*>::iterator safei; \
for (std::vector<Module*>::iterator _i = ModuleManager::EventHandlers[y].begin(); _i != ModuleManager::EventHandlers[y].end(); ) \
@@ -73,15 +73,17 @@ do \
} \
_i = safei; \
} \
-} while (0);
+} \
+else \
+ static_cast<void>(0)
/**
* This define is similar to the one above but returns a result in MOD_RESULT.
* The first module to return a nonzero result is the value to be accepted,
* and any modules after are ignored.
*/
-#define FOREACH_RESULT(y,x) \
-do \
+#define FOREACH_RESULT(y, x) \
+if (true) \
{ \
std::vector<Module*>::iterator safei; \
MOD_RESULT = EVENT_CONTINUE; \
@@ -103,7 +105,9 @@ do \
} \
_i = safei; \
} \
-} while(0);
+} \
+else \
+ static_cast<void>(0)
#ifndef _WIN32
# include <dlfcn.h>