Annotation of truecrypt/platform/finally.h, revision 1.1.1.8

1.1       root        1: /*
1.1.1.8 ! root        2:  Copyright (c) 2008-2009 TrueCrypt Developers Association. All rights reserved.
1.1       root        3: 
1.1.1.8 ! root        4:  Governed by the TrueCrypt License 2.8 the full text of which is contained in
        !             5:  the file License.txt included in TrueCrypt binary and source code distribution
        !             6:  packages.
1.1       root        7: */
                      8: 
                      9: #ifndef TC_HEADER_Platform_Finally
                     10: #define TC_HEADER_Platform_Finally
                     11: 
                     12: #include "PlatformBase.h"
                     13: 
1.1.1.2   root       14: // Execute code when leaving scope
                     15: #define finally_do(code) \
                     16: struct TC_JOIN(Finally,__LINE__) \
                     17: { \
1.1.1.5   root       18:        TC_JOIN(~Finally,__LINE__) () { try { code } catch (...) { } } \
1.1.1.2   root       19: } \
                     20: TC_UNUSED_VAR \
                     21: TC_JOIN(finally,__LINE__)
1.1       root       22: 
1.1.1.2   root       23: // Execute code with argument 'finally_arg' when leaving scope 
                     24: #define finally_do_arg(argType, arg, code) \
                     25: struct TC_JOIN(Finally,__LINE__) \
1.1       root       26: { \
                     27:        TC_JOIN(Finally,__LINE__) (argType a) : finally_arg (a) { } \
1.1.1.5   root       28:        TC_JOIN(~Finally,__LINE__) () { try { code } catch (...) { } } \
1.1       root       29:        argType finally_arg; \
1.1.1.2   root       30: } \
                     31: TC_UNUSED_VAR \
                     32: TC_JOIN(finally,__LINE__) (arg)
1.1       root       33: 
1.1.1.2   root       34: #define finally_do_arg2(argType, arg, argType2, arg2, code) \
                     35: struct TC_JOIN(Finally,__LINE__) \
1.1       root       36: { \
                     37:        TC_JOIN(Finally,__LINE__) (argType a, argType2 a2) : finally_arg (a), finally_arg2 (a2) { } \
1.1.1.5   root       38:        TC_JOIN(~Finally,__LINE__) () { try { code } catch (...) { } } \
1.1       root       39:        argType finally_arg; \
                     40:        argType2 finally_arg2; \
1.1.1.2   root       41: } \
                     42: TC_UNUSED_VAR \
                     43: TC_JOIN(finally,__LINE__) (arg, arg2)
1.1       root       44: 
                     45: 
                     46: #endif // TC_HEADER_Platform_Finally

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.