Source code of Windows XP (NT5)
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.

48 lines
1.0 KiB

  1. /***
  2. *newmode.cxx - defines C++ setHandler mode
  3. *
  4. * Copyright (c) 1994-2001, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Defines routines to set and to query the C++ new handler mode.
  8. *
  9. * The new handler mode flag determines whether malloc() failures will
  10. * call the new() failure handler, or whether malloc will return NULL.
  11. *
  12. *Revision History:
  13. * 03-03-94 SKS Initial version.
  14. * 03-04-94 SKS Rename _nhMode to _newmode
  15. * 04-14-94 GJF Made declaration of _newmode conditional on
  16. * DLL_FOR_WIN32S.
  17. * 05-01-95 GJF Replaced above change by including internal.h.
  18. *
  19. *******************************************************************************/
  20. #include <cruntime.h>
  21. #include <new.h>
  22. #include <internal.h>
  23. int __cdecl _set_new_mode( int nhm )
  24. {
  25. int nhmOld;
  26. /*
  27. * The only valid inputs are 0 and 1
  28. */
  29. if ( ( nhm & 01 ) != nhm )
  30. return -1;
  31. /*
  32. * Set the new mode and return the old
  33. */
  34. nhmOld = _newmode;
  35. _newmode = nhm;
  36. return nhmOld;
  37. }
  38. int __cdecl _query_new_mode ( void )
  39. {
  40. return _newmode;
  41. }