about summary refs log tree commit diff
path: root/src/libutil/util.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/libutil/util.hh')
-rw-r--r--src/libutil/util.hh17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libutil/util.hh b/src/libutil/util.hh
index 0d39ffee9eae..b88508dec30d 100644
--- a/src/libutil/util.hh
+++ b/src/libutil/util.hh
@@ -139,6 +139,8 @@ extern void (*writeToStderr) (const unsigned char * buf, size_t count);
 void readFull(int fd, unsigned char * buf, size_t count);
 void writeFull(int fd, const unsigned char * buf, size_t count);
 
+MakeError(EndOfFile, Error)
+
 
 /* Read a file descriptor until EOF occurs. */
 string drainFD(int fd);
@@ -147,6 +149,19 @@ string drainFD(int fd);
 
 /* Automatic cleanup of resources. */
 
+
+template <class T>
+struct AutoDeleteArray
+{
+    T * p;
+    AutoDeleteArray(T * p) : p(p) { }
+    ~AutoDeleteArray() 
+    {
+        delete [] p;
+    }
+};
+
+
 class AutoDelete
 {
     string path;
@@ -229,6 +244,8 @@ void inline checkInterrupt()
     if (_isInterrupted) _interrupted();
 }
 
+MakeError(Interrupted, Error)
+
 
 /* String packing / unpacking. */
 string packStrings(const Strings & strings);