[4164] | 1 | /* $Id: new.cpp,v 1.5 2000-09-02 21:08:14 bird Exp $
|
---|
[847] | 2 | *
|
---|
| 3 | * new - new and delete operators.
|
---|
| 4 | *
|
---|
| 5 | * Copyright (c) 1998-1999 knut st. osmundsen
|
---|
| 6 | *
|
---|
[1678] | 7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
| 8 | *
|
---|
[847] | 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 |
|
---|
[4164] | 23 | #include "devSegDf.h" /* Win32k segment definitions. */
|
---|
[847] | 24 | #include "new.h"
|
---|
[2540] | 25 | #include "rmalloc.h"
|
---|
[1271] | 26 | #include "log.h"
|
---|
[847] | 27 |
|
---|
| 28 |
|
---|
[1271] | 29 | #pragma info(none)
|
---|
[847] | 30 | /**
|
---|
| 31 | * New.
|
---|
| 32 | * @returns pointer to allocated memory.
|
---|
| 33 | * @param Size Size requested.
|
---|
| 34 | */
|
---|
| 35 | void *operator new(size_t size)
|
---|
| 36 | {
|
---|
[2540] | 37 | return rmalloc(size);
|
---|
[847] | 38 | }
|
---|
| 39 |
|
---|
| 40 |
|
---|
| 41 | /**
|
---|
| 42 | * stub
|
---|
| 43 | */
|
---|
[21916] | 44 | void *operator new(size_t size, void *location) throw()
|
---|
[847] | 45 | {
|
---|
[1271] | 46 | dprintf(("operator new(size,location) not implemented\n"));
|
---|
[847] | 47 | return NULL;
|
---|
| 48 | }
|
---|
| 49 |
|
---|
| 50 |
|
---|
| 51 | /**
|
---|
| 52 | * stub
|
---|
| 53 | */
|
---|
[21916] | 54 | void *operator new[](size_t size) throw()
|
---|
[847] | 55 | {
|
---|
[1271] | 56 | dprintf(("operator new[](size) not implemented\n"));
|
---|
[847] | 57 | return NULL;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 |
|
---|
| 61 | /**
|
---|
| 62 | * stub
|
---|
| 63 | */
|
---|
[21916] | 64 | void *operator new[](size_t size, void *location) throw()
|
---|
[847] | 65 | {
|
---|
[1271] | 66 | dprintf(("operator new[](size,location) not implemented\n"));
|
---|
[847] | 67 | return NULL;
|
---|
| 68 | }
|
---|
| 69 |
|
---|
[1271] | 70 | #ifndef __DEBUG_ALLOC__
|
---|
[847] | 71 | /**
|
---|
| 72 | * Delete.
|
---|
| 73 | * @param location Pointer to memory block which are to be freed.
|
---|
| 74 | */
|
---|
| 75 | void operator delete(void *location)
|
---|
| 76 | {
|
---|
[2540] | 77 | rfree(location);
|
---|
[847] | 78 | }
|
---|
| 79 |
|
---|
| 80 |
|
---|
| 81 | /**
|
---|
| 82 | * stub
|
---|
| 83 | */
|
---|
[21916] | 84 | void operator delete[](void *location) throw()
|
---|
[847] | 85 | {
|
---|
[1271] | 86 | dprintf(("operator delete[](location) - not implemented\n"));
|
---|
[847] | 87 | }
|
---|
[1271] | 88 | #endif
|
---|
[847] | 89 |
|
---|
[1271] | 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 | {
|
---|
[2540] | 101 | return rmalloc(size);
|
---|
[1271] | 102 | }
|
---|
| 103 |
|
---|
| 104 |
|
---|
| 105 | /**
|
---|
| 106 | * stub
|
---|
| 107 | */
|
---|
[21916] | 108 | void *operator new(size_t size, const char *filename, size_t lineno, void *location) throw()
|
---|
[1271] | 109 | {
|
---|
| 110 | dprintf(("operator new(size,location) not implemented\n"));
|
---|
| 111 | return NULL;
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 |
|
---|
| 115 | /**
|
---|
| 116 | * stub
|
---|
| 117 | */
|
---|
[21916] | 118 | void *operator new[](size_t size, const char *filename, size_t lineno) throw()
|
---|
[1271] | 119 | {
|
---|
| 120 | dprintf(("operator new[](size) not implemented\n"));
|
---|
| 121 | return NULL;
|
---|
| 122 | }
|
---|
| 123 |
|
---|
| 124 |
|
---|
| 125 | /**
|
---|
| 126 | * stub
|
---|
| 127 | */
|
---|
[21916] | 128 | void *operator new[](size_t size, const char *filename, size_t lineno, void *location) throw()
|
---|
[1271] | 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 | {
|
---|
[2540] | 141 | rfree(location);
|
---|
[1271] | 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
|
---|