From 09ccfb2b50615974d84dd02f034eda6900b6ea89 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:35:11 -0400 Subject: [PATCH] * #6547: YamlParserException: use runtime exceptions Avoid using stack variables out of their scope --- sflphone-common/src/config/yamlparser.h | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/sflphone-common/src/config/yamlparser.h b/sflphone-common/src/config/yamlparser.h index b4ebf0f901..e2fe505eca 100644 --- a/sflphone-common/src/config/yamlparser.h +++ b/sflphone-common/src/config/yamlparser.h @@ -34,7 +34,7 @@ #include "yamlnode.h" #include <yaml.h> #include <stdio.h> -#include <exception> +#include <stdexcept> #include <string> #include <vector> @@ -45,18 +45,11 @@ namespace Conf typedef std::vector<yaml_event_t> YamlEventVector; -class YamlParserException : public std::exception +class YamlParserException : public std::runtime_error { public: - YamlParserException (const std::string& str="") : errstr ("YamlParserException occured: " + str) {} - - virtual ~YamlParserException() throw() {} - - virtual const char *what() const throw() { - return errstr.c_str(); - } - private: - std::string errstr; + YamlParserException (const std::string& str="") : + std::runtime_error("YamlParserException occured: " + str) {} }; -- GitLab