summaryrefslogtreecommitdiff
path: root/include/Exceptions.h
diff options
context:
space:
mode:
authorpixel <pixel>2003-12-22 01:57:01 +0000
committerpixel <pixel>2003-12-22 01:57:01 +0000
commite27fa8bfa5181a6f102a9e9d11327e7bc61457bc (patch)
treeb5ba8b5a259423768b30818d9f4df4bdcbacbb80 /include/Exceptions.h
parent7b19da63b30ccac0eb2dff3d46de5a94f83909e3 (diff)
Introduced free as a template... (why didn'y think about it earlier?)
Diffstat (limited to 'include/Exceptions.h')
-rw-r--r--include/Exceptions.h13
1 files changed, 7 insertions, 6 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h
index 8dd473f..489a761 100644
--- a/include/Exceptions.h
+++ b/include/Exceptions.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Exceptions.h,v 1.33 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: Exceptions.h,v 1.34 2003-12-22 01:57:01 pixel Exp $ */
#ifndef __EXCEPTIONS_H__
#define __EXCEPTIONS_H__
@@ -50,9 +50,12 @@ class Base {
void * operator new(size_t s);
void * operator new(size_t s, void * p);
void operator delete(void * p);
- static void free(void *& p);
- static void free(char *& p);
- static void free(unsigned char *& p);
+ template <class T>
+ static void free(T *& p) {
+ unsigned char * t = (unsigned char *) p;
+ xfree(t);
+ p = 0;
+ }
static int pipe(int * p, int flag = 0);
static pid_t fork();
static void exit(int);
@@ -81,8 +84,6 @@ class GeneralException : public Base {
char * xstrdup(const char *);
void * xmalloc(size_t) throw (GeneralException);
-void xfree(void *&);
-void xfree(char *&);
void xfree(unsigned char *&);
void * xrealloc(void *, size_t);
int xpipe(int *, int = 0) throw (GeneralException);