Counter Strike : Global Offensive Source Code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
699 B

  1. //========= Copyright � 1996-2005, Valve Corporation, All rights reserved. ============//
  2. //
  3. // Purpose:
  4. //
  5. //=============================================================================//
  6. #include "rangecheckedvar.h"
  7. // memdbgon must be the last include file in a .cpp file!!!
  8. #include "tier0/memdbgon.h"
  9. bool g_bDoRangeChecks = true;
  10. static int g_nDisables = 0;
  11. CDisableRangeChecks::CDisableRangeChecks()
  12. {
  13. if ( !ThreadInMainThread() )
  14. return;
  15. g_nDisables++;
  16. g_bDoRangeChecks = false;
  17. }
  18. CDisableRangeChecks::~CDisableRangeChecks()
  19. {
  20. if ( !ThreadInMainThread() )
  21. return;
  22. Assert( g_nDisables > 0 );
  23. --g_nDisables;
  24. if ( g_nDisables == 0 )
  25. {
  26. g_bDoRangeChecks = true;
  27. }
  28. }