diff options
Diffstat (limited to 'lib/Exceptions.cc')
-rw-r--r-- | lib/Exceptions.cc | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index eed138a..a4fca0f 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -32,14 +32,12 @@ IOException::IOException(String fn, op_t op, ssize_t s) { msg = strdup(t); } -IOInternal::IOInternal(String fn, op_t op) { - sprintf(t, _("Internal error: has occured while %s from %s: open for %s."), op == IO_WRITE ? _("writing") : _("reading"), - fn.to_charp(), op == IO_WRITE ? _("reading") : _("writing")); - msg = strdup(t); -} - IOGeneral::IOGeneral(String fn) : GeneralException(fn) { } +IOGeneral::IOGeneral() { } + +IOAgain::IOAgain() : IOGeneral(_("No more bytes for reading or writing.")) { } + char * xstrdup(const char * s) throw (MemoryException) { char * r; @@ -62,6 +60,16 @@ void * xmalloc(ssize_t s) throw (MemoryException) { return r; } +void * xrealloc(void * ptr, size_t s) throw (MemoryException) { + void * r; + + if (!(r = ::realloc(ptr, s))) { + throw MemoryException(s); + } + + return r; +} + #ifdef OVER_FREE #undef free #endif |