OpenDDS  Snapshot(2023/04/28-20:55)
Allocation_Macros.h
Go to the documentation of this file.
1 #ifndef OPENDDS_CORBA_TAO_ALLOCATION_MACROS_H
2 #define OPENDDS_CORBA_TAO_ALLOCATION_MACROS_H
3 
4 #include "ace/Malloc_Base.h"
5 
6 # define ACE_ALLOCATOR_NEW(POINTER,CONSTRUCTOR,RET_VAL) \
7  do { void* ptr = ACE_Allocator::instance ()->malloc (sizeof (CONSTRUCTOR)); \
8  if (ptr == 0) { POINTER = 0; errno = ENOMEM; return RET_VAL;} \
9  else { POINTER = new (ptr) CONSTRUCTOR; } \
10  } while (0)
11 # define ACE_ALLOCATOR_NEW_RETURN(POINTER,CONSTRUCTOR) \
12  do { void* ptr = ACE_Allocator::instance ()->malloc (sizeof (CONSTRUCTOR)); \
13  if (ptr == 0) { POINTER = 0; errno = ENOMEM; return;} \
14  else { POINTER = new (POINTER) CONSTRUCTOR; } \
15  } while (0)
16 # define ACE_ALLOCATOR_NEW_NORETURN(POINTER,CONSTRUCTOR) \
17  do { void* ptr = ACE_Allocator::instance ()->malloc (sizeof (CONSTRUCTOR)); \
18  if (ptr == 0) { POINTER = 0; errno = ENOMEM;} \
19  else { (POINTER = new (POINTER) CONSTRUCTOR; } \
20  } while (0)
21 
22 #endif /* Allocation_Macros_h */