diff options
author | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-04-03 22:06:31 +0000 |
---|---|---|
committer | lego <lego@f5534014-38df-0310-8fa8-9805f1628bb7> | 2007-04-03 22:06:31 +0000 |
commit | a914eb4e7a056dd96ef85cb829f99e2f1ad42610 (patch) | |
tree | 34066e7d95d6b4aa5d06fa1d4aebc89c1427c714 /epan/exceptions.h | |
parent | aa0cbf604ad6320867d039388428a46ca3bbc508 (diff) |
Make sure that when a windows exception is thrown ENDTRY gets evaluated.
fix for one of the various issues that cause bug 1334
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@21332 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/exceptions.h')
-rw-r--r-- | epan/exceptions.h | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/epan/exceptions.h b/epan/exceptions.h index acf9b78a27..100a0fb151 100644 --- a/epan/exceptions.h +++ b/epan/exceptions.h @@ -74,6 +74,7 @@ #define OutOfMemoryError 6 + /* Usage: * * TRY { @@ -171,7 +172,17 @@ * RETHROW, and don't reenter FINALLY if a * different exception is thrown */ -#define TRY \ +#ifdef _MSC_VER +#define WINTRY __try { +#define WINENDTRY_BEGIN } __finally { +#define WINENDTRY_END } +#else +#define WINTRY +#define WINENDTRY_BEGIN +#define WINENDTRY_END +#endif + +#define TRY /**/\ {\ except_t *exc; \ volatile int except_state = 0; \ @@ -184,15 +195,17 @@ except_state &= ~EXCEPT_CAUGHT; \ \ if (except_state == 0 && exc == 0) \ - /* user's code goes here */ + WINTRY /* user's code goes here */ + #define ENDTRY \ - /* rethrow the exception if necessary */ \ + WINENDTRY_BEGIN /* rethrow the exception if necessary */ \ if(!(except_state&EXCEPT_CAUGHT) && exc != 0) \ except_rethrow(exc); \ - except_try_pop();\ + except_try_pop(); WINENDTRY_END\ } + /* the (except_state |= EXCEPT_CAUGHT) in the below is a way of setting * except_state before the user's code, without disrupting the user's code if * it's a one-liner. |