diff options
author | scottc <scottc> | 2002-08-28 23:06:47 +0000 |
---|---|---|
committer | scottc <scottc> | 2002-08-28 23:06:47 +0000 |
commit | 5f2169fcde2259a9d6054558d9b6c27eb7145859 (patch) | |
tree | cc2d1658bb54d4abb0df6509318913c282e2bbb5 | |
parent | 3bd5548c0ab42d41c63e9bdd7e5be07a6061c6d7 (diff) | |
download | gdb-5f2169fcde2259a9d6054558d9b6c27eb7145859.tar.gz |
* safe_memory.h: Replace #include <new> with an explicit
definition of the placement new operator.
(safe_delete): Remove unnecessary ## operator.
-rw-r--r-- | winsup/cygwin/ChangeLog | 6 | ||||
-rw-r--r-- | winsup/cygwin/safe_memory.h | 15 |
2 files changed, 14 insertions, 7 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 78afb92b854..e6ea6f1f65a 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,9 @@ +2002-08-29 Conrad Scott <conrad.scott@dsl.pipex.com> + + * safe_memory.h: Replace #include <new> with an explicit + definition of the placement new operator. + (safe_delete): Remove unnecessary ## operator. + 2002-08-28 Christopher Faylor <cgf@redhat.com> * malloc.cc: Protect some definitions to avoid a compile time warning. diff --git a/winsup/cygwin/safe_memory.h b/winsup/cygwin/safe_memory.h index f426bbb5e7f..89d724a6184 100644 --- a/winsup/cygwin/safe_memory.h +++ b/winsup/cygwin/safe_memory.h @@ -22,27 +22,28 @@ details. */ * destructor and then free(3). */ -#include <new> #include <stdlib.h> +inline void *operator new (size_t, void *__p) throw () { return __p; } + #define safe_new0(T) (new (malloc (sizeof (T))) T) #ifdef NEW_MACRO_VARARGS -#define safe_new(T, ...) \ +#define safe_new(T, ...) \ (new (malloc (sizeof (T))) T (__VA_ARGS__)) #else /* !NEW_MACRO_VARARGS */ -#define safe_new(T, args...) \ +#define safe_new(T, args...) \ (new (malloc (sizeof (T))) T (## args)) #endif /* !NEW_MACRO_VARARGS */ -#define safe_delete(T, O) \ -{ \ - (O)->~ ## T (); \ - free (O); \ +#define safe_delete(T, O) \ +{ \ + (O)->~T (); \ + free (O); \ } #endif /* __SAFE_MEMORY_H__ */ |