diff options
author | Aaron Staple <staple@cerie.counterpop.net> | 2009-04-27 16:51:35 -0700 |
---|---|---|
committer | Aaron Staple <staple@cerie.counterpop.net> | 2009-04-27 16:51:35 -0700 |
commit | ce91c67c40e24c817214e1d71bb486d7831035da (patch) | |
tree | e0449d479d3772154eda2451858ddbeecacaf087 /stdafx.h | |
parent | cc3887c8647f963d66f1fbcf7ba4b67acb43b03b (diff) | |
download | mongo-ce91c67c40e24c817214e1d71bb486d7831035da.tar.gz |
Revert "use static variables for OCCASIONALLY/RARELY/ONCE to get per function uniqueness"
This reverts commit cc3887c8647f963d66f1fbcf7ba4b67acb43b03b.
Diffstat (limited to 'stdafx.h')
-rw-r--r-- | stdafx.h | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -299,13 +299,14 @@ namespace mongo { #define DEBUGGING if( 0 ) - // The following declare one unique counter per enclosing function. - // NOTE The implementation double-increments on a match, but we don't really care. -#define SOMETIMES( occasion, howOften ) for( static unsigned occasion = 0; ++occasion % howOften == 0; ) -#define OCCASIONALLY SOMETIMES( occasionally, 16 ) -#define RARELY SOMETIMES( rarely, 128 ) -#define ONCE for( static bool undone = true; undone; undone = false ) - + extern unsigned occasion; + extern unsigned occasionR; + extern unsigned once; + +#define OCCASIONALLY if( ++occasion % 16 == 0 ) +#define RARELY if( ++occasionR % 128 == 0 ) +#define ONCE if( ++once == 1 ) + #if defined(_WIN32) #define strcasecmp _stricmp inline void our_debug_free(void *p) { |