]> git.tdb.fi Git - libs/core.git/blobdiff - source/debug/demangle.cpp
Use vectors for storage in Poller
[libs/core.git] / source / debug / demangle.cpp
index 460410e49569f501ed4792929650c62068cdf243..e41eb9ad79f32152b92503d33168c6dd1a43d337 100644 (file)
@@ -1,11 +1,7 @@
-/* $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;
@@ -17,9 +13,16 @@ string demangle(const string &sym)
 {
 #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(), 0, 0, &status);
+       
+       string result;
+       if(status==0)
+               result = dm;
+       else
+               result = sym;
+       
        free(dm);
+
        return result;
 #else
        return sym;