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.

27 lines
606 B

  1. // newop2 operator new(size_t, const nothrow_t&) for Microsoft C++
  2. #include <cstdlib>
  3. #include <new>
  4. _C_LIB_DECL
  5. int _callnewh(size_t size);
  6. _END_C_LIB_DECL
  7. void *operator new(size_t size, const std::nothrow_t&) _THROW0()
  8. { // try to allocate size bytes
  9. void *p;
  10. while ((p = malloc(size)) == 0)
  11. { // buy more memory or return null pointer
  12. _TRY_BEGIN
  13. if (_callnewh(size) == 0)
  14. break;
  15. _CATCH(std::bad_alloc)
  16. return (0);
  17. _CATCH_END
  18. }
  19. return (p);
  20. }
  21. /*
  22. * Copyright (c) 1995 by P.J. Plauger. ALL RIGHTS RESERVED.
  23. * Consult your license regarding permissions and restrictions.
  24. */