From d49d2eec3d34023bf50bb8ea6132649f2cce1992 Mon Sep 17 00:00:00 2001 From: dockes Date: Sun, 22 Nov 2009 17:26:38 +0000 Subject: [PATCH] added tempbuf class --- src/utils/smallut.h | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/utils/smallut.h b/src/utils/smallut.h index 4adb5ec6..351495cf 100644 --- a/src/utils/smallut.h +++ b/src/utils/smallut.h @@ -128,6 +128,25 @@ class Chrono { long m_nsecs; }; +class TempBuf { +public: + TempBuf() + : m_buf(0) + {} + TempBuf(int n) + { + m_buf = (char *)malloc(n); + } + ~TempBuf() + { + if (m_buf) + free(m_buf); + } + char *setsize(int n) { return (m_buf = (char *)realloc(m_buf, n)); } + char *buf() {return m_buf;} + char *m_buf; +}; + #ifndef deleteZ #define deleteZ(X) {delete X;X = 0;} #endif