src/demangle.cpp
std::string filter_whitespaces(const char* cstr, size_t size = 0) {
    std::string result;
    if (size > 0) result.reserve(size);
    char c = *cstr;
    while (c != '\0') {
        if (c == ' ') {
            char previous_c = result.empty() ? ' ' : *(result.rbegin());
            // get next non-space character
            for (c = *++cstr; c == ' '; c = *++cstr) { }
            if (c != '\0') {
                // skip whitespace unless it separates two alphanumeric
                // characters (such as in "unsigned int")
                if (isalnum(c) && isalnum(previous_c)) {
                    result += ' ';
                    result += c;
                }
                else {
                    result += c;
                }
                c = *++cstr;
            }
        }
        else {
            result += c;
            c = *++cstr;
        }
    }
    return result;
}
// filter unnecessary characters from undecorated cstr
filter unnecessary characters from undecorated cstr
filter unnecessary characters from undecorated cstr
std::string filter_whitespaces(const char* cstr, size_t size = 0) {
    std::string result;
    if (size > 0) result.reserve(size);
    char c = *cstr;
    while (c != '\0') {
        if (c == ' ') {
            char previous_c = result.empty() ? ' ' : *(result.rbegin());
            for (c = *++cstr; c == ' '; c = *++cstr) { }
            if (c != '\0') {
                if (isalnum(c) && isalnum(previous_c)) {
                    result += ' ';
                    result += c;
                }
                else {
                    result += c;
                }
                c = *++cstr;
            }
        }
        else {
            result += c;
            c = *++cstr;
        }
    }
    return result;
}
std :: string filter_whitespaces ( const char * cstr , size_t size = 0 ) { std :: string result ; if ( size > 0 ) result . reserve ( size ) ; char c = * cstr ; while ( c != ' \0 ' ) { if ( c == ' ' ) { char previous_c = result . empty ( ) ? ' ' : * ( result . rbegin ( ) ) ; for ( c = * ++ cstr ; c == ' ' ; c = * ++ cstr ) { } if ( c != ' \0 ' ) { if ( isalnum ( c ) && isalnum ( previous_c ) ) { result += ' ' ; result += c ; } else { result += c ; } c = * ++ cstr ; } } else { result += c ; c = * ++ cstr ; } } return result ; }
filter unnecessary characters from undecorated cstr
filter unnecessary characters from undecorated cstr
// get next non-space character // skip whitespace unless it separates two alphanumeric // characters (such as in "unsigned int")