| 1 | /* $Id: new.cpp,v 1.5 2000-09-02 21:08:14 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * new - new and delete operators. | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 1998-1999 knut st. osmundsen | 
|---|
| 6 | * | 
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 8 | * | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 | /******************************************************************************* | 
|---|
| 12 | *   Defined Constants                                                          * | 
|---|
| 13 | *******************************************************************************/ | 
|---|
| 14 | #define INCL_DOS | 
|---|
| 15 | #define INCL_DOSERRORS | 
|---|
| 16 | #define INCL_NOAPI | 
|---|
| 17 |  | 
|---|
| 18 | /******************************************************************************* | 
|---|
| 19 | *   Header Files                                                               * | 
|---|
| 20 | *******************************************************************************/ | 
|---|
| 21 | #include <os2.h> | 
|---|
| 22 |  | 
|---|
| 23 | #include "devSegDf.h"                   /* Win32k segment definitions. */ | 
|---|
| 24 | #include "new.h" | 
|---|
| 25 | #include "rmalloc.h" | 
|---|
| 26 | #include "log.h" | 
|---|
| 27 |  | 
|---|
| 28 |  | 
|---|
| 29 | #pragma info(none) | 
|---|
| 30 | /** | 
|---|
| 31 | * New. | 
|---|
| 32 | * @returns   pointer to allocated memory. | 
|---|
| 33 | * @param     Size  Size requested. | 
|---|
| 34 | */ | 
|---|
| 35 | void *operator new(size_t size) | 
|---|
| 36 | { | 
|---|
| 37 | return rmalloc(size); | 
|---|
| 38 | } | 
|---|
| 39 |  | 
|---|
| 40 |  | 
|---|
| 41 | /** | 
|---|
| 42 | * stub | 
|---|
| 43 | */ | 
|---|
| 44 | void *operator new(size_t size, void *location) | 
|---|
| 45 | { | 
|---|
| 46 | dprintf(("operator new(size,location) not implemented\n")); | 
|---|
| 47 | return NULL; | 
|---|
| 48 | } | 
|---|
| 49 |  | 
|---|
| 50 |  | 
|---|
| 51 | /** | 
|---|
| 52 | * stub | 
|---|
| 53 | */ | 
|---|
| 54 | void *operator new[](size_t size) | 
|---|
| 55 | { | 
|---|
| 56 | dprintf(("operator new[](size) not implemented\n")); | 
|---|
| 57 | return NULL; | 
|---|
| 58 | } | 
|---|
| 59 |  | 
|---|
| 60 |  | 
|---|
| 61 | /** | 
|---|
| 62 | * stub | 
|---|
| 63 | */ | 
|---|
| 64 | void *operator new[](size_t size, void *location) | 
|---|
| 65 | { | 
|---|
| 66 | dprintf(("operator new[](size,location) not implemented\n")); | 
|---|
| 67 | return NULL; | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | #ifndef __DEBUG_ALLOC__ | 
|---|
| 71 | /** | 
|---|
| 72 | * Delete. | 
|---|
| 73 | * @param     location  Pointer to memory block which are to be freed. | 
|---|
| 74 | */ | 
|---|
| 75 | void operator delete(void *location) | 
|---|
| 76 | { | 
|---|
| 77 | rfree(location); | 
|---|
| 78 | } | 
|---|
| 79 |  | 
|---|
| 80 |  | 
|---|
| 81 | /** | 
|---|
| 82 | * stub | 
|---|
| 83 | */ | 
|---|
| 84 | void operator delete[](void *location) | 
|---|
| 85 | { | 
|---|
| 86 | dprintf(("operator delete[](location) - not implemented\n")); | 
|---|
| 87 | } | 
|---|
| 88 | #endif | 
|---|
| 89 |  | 
|---|
| 90 | /*** | 
|---|
| 91 | *  debug! | 
|---|
| 92 | ***/ | 
|---|
| 93 |  | 
|---|
| 94 | /** | 
|---|
| 95 | * New. | 
|---|
| 96 | * @returns   pointer to allocated memory. | 
|---|
| 97 | * @param     Size  Size requested. | 
|---|
| 98 | */ | 
|---|
| 99 | void *operator new(size_t size, const char *filename, size_t lineno) | 
|---|
| 100 | { | 
|---|
| 101 | return rmalloc(size); | 
|---|
| 102 | } | 
|---|
| 103 |  | 
|---|
| 104 |  | 
|---|
| 105 | /** | 
|---|
| 106 | * stub | 
|---|
| 107 | */ | 
|---|
| 108 | void *operator new(size_t size, const char *filename, size_t lineno, void *location) | 
|---|
| 109 | { | 
|---|
| 110 | dprintf(("operator new(size,location) not implemented\n")); | 
|---|
| 111 | return NULL; | 
|---|
| 112 | } | 
|---|
| 113 |  | 
|---|
| 114 |  | 
|---|
| 115 | /** | 
|---|
| 116 | * stub | 
|---|
| 117 | */ | 
|---|
| 118 | void *operator new[](size_t size, const char *filename, size_t lineno) | 
|---|
| 119 | { | 
|---|
| 120 | dprintf(("operator new[](size) not implemented\n")); | 
|---|
| 121 | return NULL; | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 |  | 
|---|
| 125 | /** | 
|---|
| 126 | * stub | 
|---|
| 127 | */ | 
|---|
| 128 | void *operator new[](size_t size, const char *filename, size_t lineno, void *location) | 
|---|
| 129 | { | 
|---|
| 130 | dprintf(("operator new[](size,location) not implemented\n")); | 
|---|
| 131 | return NULL; | 
|---|
| 132 | } | 
|---|
| 133 |  | 
|---|
| 134 | #ifdef __DEBUG_ALLOC__ | 
|---|
| 135 | /** | 
|---|
| 136 | * Delete. | 
|---|
| 137 | * @param     location  Pointer to memory block which are to be freed. | 
|---|
| 138 | */ | 
|---|
| 139 | void operator delete(void *location, const char *filename, size_t lineno) | 
|---|
| 140 | { | 
|---|
| 141 | rfree(location); | 
|---|
| 142 | } | 
|---|
| 143 |  | 
|---|
| 144 |  | 
|---|
| 145 | /** | 
|---|
| 146 | * stub | 
|---|
| 147 | */ | 
|---|
| 148 | void operator delete[](void *location, const char *filename, size_t lineno) | 
|---|
| 149 | { | 
|---|
| 150 | dprintf(("operator delete[](location) - not implemented\n")); | 
|---|
| 151 | } | 
|---|
| 152 | #endif | 
|---|