X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a6aaba20655bd0936e02369871764649b740c04b..b9c27830674f1ed54f9553d4cd517842acc1aab1:/src/cxx/NullPointerException.cxx diff --git a/src/cxx/NullPointerException.cxx b/src/cxx/NullPointerException.cxx index 79aac802b6..df42ea3fa8 100644 --- a/src/cxx/NullPointerException.cxx +++ b/src/cxx/NullPointerException.cxx @@ -1,75 +1,75 @@ -/* - * NullPointerException.cxx - * - * Copyright 2006,2007 Martin Quinson, Malek Cherier - * All right reserved. - * - * This program is free software; you can redistribute - * it and/or modify it under the terms of the license - *(GNU LGPL) which comes with this package. - * - */ - - /* NullPointerException member functions implementation. - */ - -#include - -#include -#include -#include - -namespace SimGrid -{ - namespace Msg - { - - NullPointerException::NullPointerException() - { - this->reason = (char*) calloc(strlen("Null pointer : unknown") + 1, sizeof(char)); - strcpy(this->reason, "Null pointer : unknown"); - } - - - NullPointerException::NullPointerException(const NullPointerException& rNullPointerException) - { - const char* reason = rNullPointerException.toString(); - this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char)); - strcpy(this->reason, reason); - - } - - - NullPointerException::NullPointerException(const char* name) - { - this->reason = (char*) calloc(strlen("Null pointer : ") + strlen(name) + 1, sizeof(char)); - sprintf(this->reason, "Null pointer : %s", name); - } - - - NullPointerException::~NullPointerException() - { - if(this->reason) - free(this->reason); - } - - const char* NullPointerException::toString(void) const - { - return (const char*)(this->reason); - } - - - const NullPointerException& NullPointerException::operator = (const NullPointerException& rNullPointerException) - { - const char* reason = rNullPointerException.toString(); - this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char)); - - return *this; - } - - } // namespace Msg - -}// namespace SimGrid - - - +/* + * NullPointerException.cxx + * + * Copyright 2006,2007 Martin Quinson, Malek Cherier + * All right reserved. + * + * This program is free software; you can redistribute + * it and/or modify it under the terms of the license + *(GNU LGPL) which comes with this package. + * + */ + + /* NullPointerException member functions implementation. + */ + +#include + +#include +#include +#include + +namespace SimGrid +{ + namespace Msg + { + + NullPointerException::NullPointerException() + { + this->reason = (char*) calloc(strlen("Null pointer : unknown") + 1, sizeof(char)); + strcpy(this->reason, "Null pointer : unknown"); + } + + + NullPointerException::NullPointerException(const NullPointerException& rNullPointerException) + { + const char* reason = rNullPointerException.toString(); + this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char)); + strcpy(this->reason, reason); + + } + + + NullPointerException::NullPointerException(const char* name) + { + this->reason = (char*) calloc(strlen("Null pointer : ") + strlen(name) + 1, sizeof(char)); + sprintf(this->reason, "Null pointer : %s", name); + } + + + NullPointerException::~NullPointerException() + { + if(this->reason) + free(this->reason); + } + + const char* NullPointerException::toString(void) const + { + return (const char*)(this->reason); + } + + + const NullPointerException& NullPointerException::operator = (const NullPointerException& rNullPointerException) + { + const char* reason = rNullPointerException.toString(); + this->reason = (char*) calloc(strlen(reason) + 1, sizeof(char)); + + return *this; + } + + } // namespace Msg + +}// namespace SimGrid + + +