summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
Diffstat (limited to 'mysys')
-rw-r--r--mysys/Makefile.am3
-rw-r--r--mysys/my_new.cc49
2 files changed, 51 insertions, 1 deletions
diff --git a/mysys/Makefile.am b/mysys/Makefile.am
index 6dd9bb06fe9..73cd9768013 100644
--- a/mysys/Makefile.am
+++ b/mysys/Makefile.am
@@ -30,7 +30,8 @@ libmysys_a_SOURCES = my_init.c my_getwd.c mf_getdate.c\
mf_iocache.c mf_iocache2.c mf_cache.c mf_tempfile.c \
my_lock.c mf_brkhant.c my_alarm.c \
my_malloc.c my_realloc.c my_once.c mulalloc.c \
- my_alloc.c safemalloc.c my_fopen.c my_fstream.c \
+ my_alloc.c safemalloc.c my_new.cc \
+ my_fopen.c my_fstream.c \
my_error.c errors.c my_div.c my_messnc.c \
mf_format.c mf_same.c mf_dirname.c mf_fn_ext.c \
my_symlink.c my_symlink2.c \
diff --git a/mysys/my_new.cc b/mysys/my_new.cc
new file mode 100644
index 00000000000..5cc291af9aa
--- /dev/null
+++ b/mysys/my_new.cc
@@ -0,0 +1,49 @@
+/* Copyright (C) 2000 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+/*
+ This is a replacement of new/delete operators to be used when compiling
+ with gcc 3.0.x to avoid including libstdc++
+*/
+
+#include "mysys_priv.h"
+
+#ifdef USE_MYSYS_NEW
+
+void *operator new (size_t sz)
+{
+ return (void *) malloc (sz ? sz+1 : sz);
+}
+
+void *operator new[] (size_t sz)
+{
+ return (void *) malloc (sz ? sz+1 : sz);
+}
+
+void operator delete (void *ptr)
+{
+ if (ptr)
+ free(ptr);
+}
+
+void operator delete[] (void *ptr) throw ()
+{
+ if (ptr)
+ free(ptr);
+}
+
+#endif /* USE_MYSYS_NEW */
+