Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

unused tree pointer variable in CC

(1/1)

ollydbg:
When build CC, I find some un-used variables, like:

--- Code: ---size_t NativeParser::ResolveActualType(wxString searchText, const TokenIdxSet& searchScope, TokenIdxSet& result)
{
    // break up the search text for next analysis.
    std::queue<ParserComponent> typeComponents;
    BreakUpComponents(searchText, typeComponents);
    if (!typeComponents.empty())
    {
        TokenIdxSet initialScope;
        if (!searchScope.empty())
            initialScope = searchScope;
        else
            initialScope.insert(-1);

        TokensTree* tree = m_Parser->GetTokensTree(); // accessed by GenerateResultSet

        CC_LOCKER_TRACK_TT_MTX_LOCK(s_TokensTreeMutex)

        while (!typeComponents.empty())
        {
            TokenIdxSet initialResult;
            ParserComponent component = typeComponents.front();
            typeComponents.pop();
            wxString actualTypeStr = component.component;

            // All functions that call the recursive GenerateResultSet should already entered a critical section.
            GenerateResultSet(actualTypeStr, initialScope, initialResult, true, false, 0xFFFF);

            if (!initialResult.empty())
            {
                initialScope.clear();
                for (TokenIdxSet::iterator it = initialResult.begin(); it != initialResult.end(); ++it)
                    // TODO (blueshake#1#): eclimate the variable/function
                    initialScope.insert(*it);
            }
            else
            {
                initialScope.clear();
                break;
            }
        }

        CC_LOCKER_TRACK_TT_MTX_UNLOCK(s_TokensTreeMutex)

        if (!initialScope.empty())
            result = initialScope;
    }

    return result.size();
}

--- End code ---

What does this means? comments is still confusing.

--- Code: ---TokensTree* tree = m_Parser->GetTokensTree(); // accessed by GenerateResultSet

--- End code ---

MortenMacFly:

--- Quote from: ollydbg on February 07, 2012, 07:55:07 am ---TokensTree* tree = m_Parser->GetTokensTree(); // accessed by GenerateResultSet

--- End quote ---
You can comment these lines. They were for me to understand, what tree has to be locked when calling one of the recursive functions that require a lock from "outside" (i.e. the caller). Don't remove, just comment please.

Navigation

[0] Message Index

Go to full version