diff options
author | Pixel <pixel@nobis-crew.org> | 2008-10-08 09:20:04 -0700 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2008-10-08 09:20:04 -0700 |
commit | 2d57145f789c3e87cc950c3ceab76870cd98beff (patch) | |
tree | 49f38c12d45d0508f74fa365ad6ef7e536c32455 | |
parent | f80b1b0eb1355de26b262ecef23d93d5ec0b9cba (diff) |
Avoiding passing on strings by copy during exceptions.
-rw-r--r-- | include/Exceptions.h | 6 | ||||
-rw-r--r-- | lib/Exceptions.cc | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/include/Exceptions.h b/include/Exceptions.h index d52d245..52f51c4 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -89,7 +89,7 @@ class Base { class GeneralException : public Base { public: //! The constructor has to provide a string describing the exception. - GeneralException(String); + GeneralException(const String &); GeneralException(const GeneralException &); ~GeneralException(); //! This should only be used by the exception manager in order to display what went wrong. @@ -129,14 +129,14 @@ enum op_t { class IOGeneral : public GeneralException { public: - IOGeneral(String); + IOGeneral(const String &); protected: IOGeneral(); }; class IOException : public IOGeneral { public: - IOException(String, op_t, ssize_t); + IOException(const String &, op_t, ssize_t); }; class IOAgain : public IOGeneral { diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index 8a66e68..5c14404 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -49,7 +49,7 @@ char GeneralException::t[BUFSIZ]; std::vector<String> Base::context; -GeneralException::GeneralException(String emsg) : msg(emsg.strdup()) { +GeneralException::GeneralException(const String & emsg) : msg(emsg.strdup()) { UNLOCK; #ifdef DEBUG printm(M_BARE, String(_("Generating a General Exception error: '")) + msg + "'.\n"); @@ -83,13 +83,13 @@ MemoryException::MemoryException(ssize_t s) { msg = strdup(t); } -IOException::IOException(String fn, op_t op, ssize_t s) { +IOException::IOException(const String & fn, op_t op, ssize_t s) { sprintf(t, _("An error has occured while %s %u bytes on %s: %s"), op == IO_WRITE ? _("writing") : _("reading"), s, fn.to_charp(), strerror(errno)); msg = strdup(t); } -IOGeneral::IOGeneral(String fn) : GeneralException(fn) { } +IOGeneral::IOGeneral(const String & fn) : GeneralException(fn) { } IOGeneral::IOGeneral() { } |