-/* $Id$
-
-This file is part of libmspcore
-Copyright © 2007 Mikko Rasa, Mikkosoft Productions
-Distributed under the LGPL
-*/
-
+#include <cstdlib>
+#ifdef __GNUC__
#include <cxxabi.h>
+#endif
#include "demangle.h"
using namespace std;
{
#ifdef __GNUC__
int status;
- char *dm=abi::__cxa_demangle(sym.c_str(), 0, 0, &status);
- string result(dm);
+ char *dm = abi::__cxa_demangle(sym.c_str(), nullptr, nullptr, &status);
+
+ string result;
+ if(status==0)
+ result = dm;
+ else
+ result = sym;
+
free(dm);
+
return result;
#else
return sym;