CnC_Remastered_Collection

Command and Conquer: Red Alert
Log | Files | Refs | README | LICENSE

NEWDEL.CPP (7244B)


      1 //
      2 // Copyright 2020 Electronic Arts Inc.
      3 //
      4 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free 
      5 // software: you can redistribute it and/or modify it under the terms of 
      6 // the GNU General Public License as published by the Free Software Foundation, 
      7 // either version 3 of the License, or (at your option) any later version.
      8 
      9 // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed 
     10 // in the hope that it will be useful, but with permitted additional restrictions 
     11 // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT 
     12 // distributed with this program. You should have received a copy of the 
     13 // GNU General Public License along with permitted additional restrictions 
     14 // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
     15 
     16 /***************************************************************************
     17  **     C O N F I D E N T I A L --- W E S T W O O D   S T U D I O S       **
     18  ***************************************************************************
     19  *                                                                         *
     20  *                 Project Name : Memory system.                           *
     21  *                                                                         *
     22  *                    File Name : NEWDEL.CPP                               *
     23  *                                                                         *
     24  *                   Programmer : Scott K. Bowen                           *
     25  *                                                                         *
     26  *                   Start Date : June 21, 1994                            *
     27  *                                                                         *
     28  *                  Last Update : October 20, 1994   [SKB]                 *
     29  *                                                                         *
     30  *-------------------------------------------------------------------------*
     31  * Functions:                                                              *
     32  *   operator NEW -- Overides the global new function.                     *
     33  *   operator delete -- Overides the global delete function.               *
     34  *   operator NEW[] -- Overides the array version of new.                  *
     35  *   operator delete[] -- Overides the array version of delete[]           *
     36  * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
     37 
     38 #include "wwmem.h"
     39 
     40 
     41 /*=========================================================================*/
     42 /* The following PRIVATE functions are in this file:                       */
     43 /*=========================================================================*/
     44 
     45 /*= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =*/
     46 
     47 
     48 /***************************************************************************
     49  * OPERATOR NEW -- Overides the global new function.                       *
     50  *                                                                         *
     51  * INPUT:                                                                  *
     52  *                                                                         *
     53  * OUTPUT:                                                                 *
     54  *                                                                         *
     55  * WARNINGS:                                                               *
     56  *                                                                         *
     57  * HISTORY:                                                                *
     58  *   06/21/1994 SKB : Created.                                             *
     59  *=========================================================================*/
     60 void * operator new(size_t size) 
     61 {
     62 	return (Alloc((unsigned long) size, MEM_NEW));
     63 }
     64 
     65 
     66 /***************************************************************************
     67  * OPERATOR NEW[] -- Overides the array version of new.                    *
     68  *                                                                         *
     69  *                                                                         *
     70  *                                                                         *
     71  * INPUT:                                                                  *
     72  *                                                                         *
     73  * OUTPUT:                                                                 *
     74  *                                                                         *
     75  * WARNINGS:                                                               *
     76  *                                                                         *
     77  * HISTORY:                                                                *
     78  *   06/21/1994 SKB : Created.                                             *
     79  *=========================================================================*/
     80 void * operator new[](size_t size) 
     81 {
     82 	return (Alloc((unsigned long) size, MEM_NEW));
     83 }
     84  
     85 
     86 /***************************************************************************
     87  * OPERATOR DELETE -- Overides the global delete function.                 *
     88  *                                                                         *
     89  *                                                                         *
     90  *                                                                         *
     91  * INPUT:                                                                  *
     92  *                                                                         *
     93  * OUTPUT:                                                                 *
     94  *                                                                         *
     95  * WARNINGS:                                                               *
     96  *                                                                         *
     97  * HISTORY:                                                                *
     98  *   06/21/1994 SKB : Created.                                             *
     99  *=========================================================================*/
    100 void operator delete(void *ptr) 
    101 {
    102 	Free(ptr);
    103 }
    104 
    105 /***************************************************************************
    106  * OPERATOR DELETE[] -- Overides the array version of delete[]           	*
    107  *                                                                         *
    108  *                                                                         *
    109  *                                                                         *
    110  * INPUT:                                                                  *
    111  *                                                                         *
    112  * OUTPUT:                                                                 *
    113  *                                                                         *
    114  * WARNINGS:                                                               *
    115  *                                                                         *
    116  * HISTORY:                                                                *
    117  *   10/20/1994 SKB : Created.                                             *
    118  *=========================================================================*/
    119 void operator delete[](void *ptr) 
    120 {
    121 	Free(ptr);
    122 }
    123 
    124 
    125