]> git.tdb.fi Git - libs/core.git/blobdiff - source/debug/demangle.cpp
Make sure all files have the correct header
[libs/core.git] / source / debug / demangle.cpp
index 460410e49569f501ed4792929650c62068cdf243..fc6ca7823f3d0eaf5d903c641dee848c1e77fef4 100644 (file)
@@ -5,7 +5,10 @@ Copyright © 2007 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
 
+#include <cstdlib>
+#ifdef __GNUC__
 #include <cxxabi.h>
+#endif
 #include "demangle.h"
 
 using namespace std;
@@ -18,8 +21,15 @@ string demangle(const string &sym)
 #ifdef __GNUC__
        int status;
        char *dm=abi::__cxa_demangle(sym.c_str(), 0, 0, &status);
-       string result(dm);
+       
+       string result;
+       if(status==0)
+               result=dm;
+       else
+               result=sym;
+       
        free(dm);
+
        return result;
 #else
        return sym;