Commit 1398a1a9 authored by Dmitry Lenev's avatar Dmitry Lenev

Follow-up for bug#52289 "performance regression

for MyISAM in sysbench OLTP_RW test".

Fixes compilation warnings about local variable
shadowing I_P_List_fast_push_back::last member.

Renamed I_P_List_fast_push_back::last member
to m_last. Also to keep member naming consistent
renamed I_P_List::first member to m_first.
parent cc90cbbe
...@@ -66,7 +66,7 @@ template <typename T, typename B, ...@@ -66,7 +66,7 @@ template <typename T, typename B,
typename I = I_P_List_no_push_back<T> > typename I = I_P_List_no_push_back<T> >
class I_P_List : public C, public I class I_P_List : public C, public I
{ {
T *first; T *m_first;
/* /*
Do not prohibit copying of I_P_List object to simplify their usage in Do not prohibit copying of I_P_List object to simplify their usage in
...@@ -74,18 +74,18 @@ class I_P_List : public C, public I ...@@ -74,18 +74,18 @@ class I_P_List : public C, public I
is a bad idea. is a bad idea.
*/ */
public: public:
I_P_List() : I(&first), first(NULL) {}; I_P_List() : I(&m_first), m_first(NULL) {};
inline void empty() { first= NULL; C::reset(); I::set_last(&first); } inline void empty() { m_first= NULL; C::reset(); I::set_last(&m_first); }
inline bool is_empty() const { return (first == NULL); } inline bool is_empty() const { return (m_first == NULL); }
inline void push_front(T* a) inline void push_front(T* a)
{ {
*B::next_ptr(a)= first; *B::next_ptr(a)= m_first;
if (first) if (m_first)
*B::prev_ptr(first)= B::next_ptr(a); *B::prev_ptr(m_first)= B::next_ptr(a);
else else
I::set_last(B::next_ptr(a)); I::set_last(B::next_ptr(a));
first= a; m_first= a;
*B::prev_ptr(a)= &first; *B::prev_ptr(a)= &m_first;
C::inc(); C::inc();
} }
inline void push_back(T *a) inline void push_back(T *a)
...@@ -124,20 +124,20 @@ class I_P_List : public C, public I ...@@ -124,20 +124,20 @@ class I_P_List : public C, public I
**B::prev_ptr(a)= next; **B::prev_ptr(a)= next;
C::dec(); C::dec();
} }
inline T* front() { return first; } inline T* front() { return m_first; }
inline const T *front() const { return first; } inline const T *front() const { return m_first; }
void swap(I_P_List<T, B, C> &rhs) void swap(I_P_List<T, B, C> &rhs)
{ {
swap_variables(T *, first, rhs.first); swap_variables(T *, m_first, rhs.m_first);
I::swap(rhs); I::swap(rhs);
if (first) if (m_first)
*B::prev_ptr(first)= &first; *B::prev_ptr(m_first)= &m_first;
else else
I::set_last(&first); I::set_last(&m_first);
if (rhs.first) if (rhs.m_first)
*B::prev_ptr(rhs.first)= &rhs.first; *B::prev_ptr(rhs.m_first)= &rhs.m_first;
else else
I::set_last(&rhs.first); I::set_last(&rhs.m_first);
C::swap(rhs); C::swap(rhs);
} }
#ifndef _lint #ifndef _lint
...@@ -160,13 +160,13 @@ class I_P_List_iterator ...@@ -160,13 +160,13 @@ class I_P_List_iterator
T *current; T *current;
public: public:
I_P_List_iterator(const I_P_List<T, B, C, I> &a) I_P_List_iterator(const I_P_List<T, B, C, I> &a)
: list(&a), current(a.first) {} : list(&a), current(a.m_first) {}
I_P_List_iterator(const I_P_List<T, B, C, I> &a, T* current_arg) I_P_List_iterator(const I_P_List<T, B, C, I> &a, T* current_arg)
: list(&a), current(current_arg) {} : list(&a), current(current_arg) {}
inline void init(const I_P_List<T, B, C, I> &a) inline void init(const I_P_List<T, B, C, I> &a)
{ {
list= &a; list= &a;
current= a.first; current= a.m_first;
} }
inline T* operator++(int) inline T* operator++(int)
{ {
...@@ -182,7 +182,7 @@ class I_P_List_iterator ...@@ -182,7 +182,7 @@ class I_P_List_iterator
} }
inline void rewind() inline void rewind()
{ {
current= list->first; current= list->m_first;
} }
}; };
...@@ -248,13 +248,13 @@ template <typename T> class I_P_List_no_push_back ...@@ -248,13 +248,13 @@ template <typename T> class I_P_List_no_push_back
template <typename T> class I_P_List_fast_push_back template <typename T> class I_P_List_fast_push_back
{ {
T **last; T **m_last;
protected: protected:
I_P_List_fast_push_back(T **a) : last(a) { }; I_P_List_fast_push_back(T **a) : m_last(a) { };
void set_last(T **a) { last= a; } void set_last(T **a) { m_last= a; }
T** get_last() const { return last; } T** get_last() const { return m_last; }
void swap(I_P_List_fast_push_back<T> &rhs) void swap(I_P_List_fast_push_back<T> &rhs)
{ swap_variables(T**, last, rhs.last); } { swap_variables(T**, m_last, rhs.m_last); }
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment