From d2a4dc9fd11b9619e3e77b42186efb6258620d58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C3=ABl=20Carr=C3=A9?= <rafael.carre@savoirfairelinux.com> Date: Thu, 28 Jul 2011 14:30:03 -0400 Subject: [PATCH] * #6547: YamlEmitterException: use runtime exceptions Avoid using stack variables out of their scope --- sflphone-common/src/config/yamlemitter.h | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/sflphone-common/src/config/yamlemitter.h b/sflphone-common/src/config/yamlemitter.h index 8c45c3ab27..13f3c8df78 100644 --- a/sflphone-common/src/config/yamlemitter.h +++ b/sflphone-common/src/config/yamlemitter.h @@ -32,7 +32,7 @@ #define __YAMLEMITTER_H__ #include <yaml.h> -#include <exception> +#include <stdexcept> #include <string> #include "yamlnode.h" @@ -42,22 +42,11 @@ namespace Conf #define EMITTER_BUFFERSIZE 65536 #define EMITTER_MAXEVENT 1024 -class YamlEmitterException : public std::exception +class YamlEmitterException : public std::runtime_error { public: - YamlEmitterException (const std::string& str="") throw() : errstr (str) {} - - virtual ~YamlEmitterException() throw() {} - - virtual const char *what() const throw() { - std::string expt ("YamlParserException occured: "); - expt.append (errstr); - - return expt.c_str(); - } - private: - std::string errstr; - + YamlEmitterException (const std::string& str="") : + std::runtime_error("YamlParserException occured: " + str) {} }; class YamlEmitter -- GitLab