From c41f2e951488ffe97a35386a29fd92dfe9ad0ac9 Mon Sep 17 00:00:00 2001 From: Jim Kowalkowski Date: Mon, 19 May 1997 19:23:51 +0000 Subject: [PATCH] Fixed bug in new/delete operators for gddBounds1D, 2D, and 3D --- src/gdd/gddNewDel.h | 11 +++++++---- src/gdd/gddUtils.h | 9 ++++++--- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/gdd/gddNewDel.h b/src/gdd/gddNewDel.h index b5b66d950..a7ad407a6 100644 --- a/src/gdd/gddNewDel.h +++ b/src/gdd/gddNewDel.h @@ -8,6 +8,9 @@ * $Id$ * * $Log$ + * Revision 1.2 1997/03/21 01:56:09 jbk + * *** empty log message *** + * * Revision 1.1 1996/06/25 19:11:47 jbk * new in EPICS base * @@ -26,7 +29,6 @@ // Avoid using templates at the cost of very poor readability. // This forces the user to have a static data member named "gddNewDel_freelist" -// This also forces the user to have a data member named "gddNewDel_next" // To use this stuff: // @@ -34,7 +36,7 @@ // class myClass // { // public: -// gdd_NEWDEL_FUNC(myClass) +// gdd_NEWDEL_FUNC(address_to_be_used_for_freelist_next_pointer) // private: // gdd_NEWDEL_DATA(myClass) // }; @@ -53,11 +55,12 @@ static gddSemaphore newdel_lock; // public interface for the new/delete stuff +// user gives this macro the address they want to use for the next pointer #define gdd_NEWDEL_FUNC(fld) \ void* operator new(size_t); \ void operator delete(void*); \ - char* newdel_next(void) { return (char*)fld; } \ - void newdel_setNext(char* n) { char** x=(char**)&fld; *x=n; } + char* newdel_next(void) { char** x=(char**)&(fld); return *x; } \ + void newdel_setNext(char* n) { char** x=(char**)&(fld); *x=n; } // declaration of the static variable for the free list #define gdd_NEWDEL_STAT(clas) \ diff --git a/src/gdd/gddUtils.h b/src/gdd/gddUtils.h index 282d7f723..f31f3b3ef 100644 --- a/src/gdd/gddUtils.h +++ b/src/gdd/gddUtils.h @@ -8,6 +8,9 @@ * $Id$ * * $Log$ + * Revision 1.3 1997/04/23 17:13:07 jhill + * fixed export of symbols from WIN32 DLL + * * Revision 1.2 1997/03/21 01:56:11 jbk * *** empty log message *** * @@ -118,7 +121,7 @@ class epicsShareClass gddBounds1D public: gddBounds1D(void) { } gddBounds* boundArray(void); - gdd_NEWDEL_FUNC(b); // required for using generic new and remove + gdd_NEWDEL_FUNC(b[0]); // required for using generic new and remove private: gddBounds b[1]; gdd_NEWDEL_DATA // required for using generic new/remove @@ -130,7 +133,7 @@ class epicsShareClass gddBounds2D public: gddBounds2D(void) { } gddBounds* boundArray(void); - gdd_NEWDEL_FUNC(b); // required for using generic new and remove + gdd_NEWDEL_FUNC(b[0]); // required for using generic new and remove private: gddBounds b[2]; gdd_NEWDEL_DATA // required for using generic new/remove @@ -142,7 +145,7 @@ class epicsShareClass gddBounds3D public: gddBounds3D(void) { } gddBounds* boundArray(void); - gdd_NEWDEL_FUNC(b); // for using generic new and remove + gdd_NEWDEL_FUNC(b[0]); // for using generic new and remove private: gddBounds b[3]; gdd_NEWDEL_DATA // required for using generic new/remove