Skip to content

Commit

Permalink
renamed token private index member to id
Browse files Browse the repository at this point in the history
an index member may be needed for the encoder, so the private member
used for detecting token leaks was renamed to m_id (the index member
did not have the 'm_' prefix anyway)
  • Loading branch information
thunder422 committed Aug 30, 2013
1 parent 17f3524 commit 34a7969
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions token.cpp
Expand Up @@ -497,15 +497,15 @@ void *Token::operator new(size_t size)
token = (Token *)::operator new(size);

// set index into used vector and add to vector
token->index = s_used.size();
token->m_id = s_used.size();
s_used.append(token);
}
else // get a token from the free stack
{
token = s_freeStack.pop();

// mark token as used
s_used[token->index] = token;
s_used[token->m_id] = token;
}

// return pointer to new token
Expand All @@ -526,14 +526,14 @@ void Token::operator delete(void *ptr)
{
Token *token = (Token *)ptr;

if (s_used[token->index] == NULL) // already deleted?
if (s_used[token->m_id] == NULL) // already deleted?
{
s_deleted.append(QString("%1: %2").arg(token->index)
s_deleted.append(QString("%1: %2").arg(token->m_id)
.arg(token->text()));
}
else // mark token as unused and cache on free stack
{
s_used[token->index] = NULL;
s_used[token->m_id] = NULL;
s_freeStack.push(token);
}
}
Expand Down
2 changes: 1 addition & 1 deletion token.h
Expand Up @@ -54,7 +54,7 @@ class Token
{
Q_DECLARE_TR_FUNCTIONS(Token)

int index; // private index for detecting token leaks
int m_id; // private ID (index) for detecting token leaks
int m_column; // start column of token
int m_length; // length of token
TokenType m_type; // type of the token
Expand Down

0 comments on commit 34a7969

Please sign in to comment.