Reformatted list classes.

BUG=
TEST=Trybots

Review URL: https://webrtc-codereview.appspot.com/995004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3291 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
phoglund@webrtc.org 2012-12-14 09:52:34 +00:00
parent 32519398b6
commit 52d981f60c
6 changed files with 822 additions and 913 deletions

View File

@ -11,13 +11,13 @@
#ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LIST_WRAPPER_H_ #ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LIST_WRAPPER_H_
#define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LIST_WRAPPER_H_ #define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LIST_WRAPPER_H_
#include "constructor_magic.h" #include "webrtc/system_wrappers/interface/constructor_magic.h"
namespace webrtc { namespace webrtc {
class CriticalSectionWrapper; class CriticalSectionWrapper;
class ListItem class ListItem {
{
friend class ListWrapper; friend class ListWrapper;
public: public:
@ -36,8 +36,7 @@ private:
const unsigned int item_; const unsigned int item_;
}; };
class ListWrapper class ListWrapper {
{
public: public:
ListWrapper(); ListWrapper();
virtual ~ListWrapper(); virtual ~ListWrapper();
@ -102,6 +101,7 @@ private:
ListItem* last_; ListItem* last_;
unsigned int size_; unsigned int size_;
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LIST_WRAPPER_H_ #endif // WEBRTC_SYSTEM_WRAPPERS_INTERFACE_LIST_WRAPPER_H_

View File

@ -8,39 +8,35 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "list_wrapper.h" #include "webrtc/system_wrappers/interface/list_wrapper.h"
#include "critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/critical_section_wrapper.h"
#include "trace.h" #include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc { namespace webrtc {
ListItem::ListItem(const void* item) ListItem::ListItem(const void* item)
: next_(0), : next_(0),
prev_(0), prev_(0),
item_ptr_(item), item_ptr_(item),
item_(0) item_(0) {
{
} }
ListItem::ListItem(const unsigned int item) ListItem::ListItem(const unsigned int item)
: next_(0), : next_(0),
prev_(0), prev_(0),
item_ptr_(0), item_ptr_(0),
item_(item) item_(item) {
{
} }
ListItem::~ListItem() ListItem::~ListItem() {
{
} }
void* ListItem::GetItem() const void* ListItem::GetItem() const {
{
return const_cast<void*>(item_ptr_); return const_cast<void*>(item_ptr_);
} }
unsigned int ListItem::GetUnsignedItem() const unsigned int ListItem::GetUnsignedItem() const {
{
return item_; return item_;
} }
@ -48,14 +44,11 @@ ListWrapper::ListWrapper()
: critical_section_(CriticalSectionWrapper::CreateCriticalSection()), : critical_section_(CriticalSectionWrapper::CreateCriticalSection()),
first_(0), first_(0),
last_(0), last_(0),
size_(0) size_(0) {
{
} }
ListWrapper::~ListWrapper() ListWrapper::~ListWrapper() {
{ if (!Empty()) {
if (!Empty())
{
// TODO(hellner) I'm not sure this loggin is useful. // TODO(hellner) I'm not sure this loggin is useful.
WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1, WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1,
"Potential memory leak in ListWrapper"); "Potential memory leak in ListWrapper");
@ -66,102 +59,84 @@ ListWrapper::~ListWrapper()
delete critical_section_; delete critical_section_;
} }
bool ListWrapper::Empty() const bool ListWrapper::Empty() const {
{
return !first_ && !last_; return !first_ && !last_;
} }
unsigned int ListWrapper::GetSize() const unsigned int ListWrapper::GetSize() const {
{
return size_; return size_;
} }
int ListWrapper::PushBack(const void* ptr) int ListWrapper::PushBack(const void* ptr) {
{
ListItem* item = new ListItem(ptr); ListItem* item = new ListItem(ptr);
CriticalSectionScoped lock(critical_section_); CriticalSectionScoped lock(critical_section_);
PushBackImpl(item); PushBackImpl(item);
return 0; return 0;
} }
int ListWrapper::PushBack(const unsigned int item_id) int ListWrapper::PushBack(const unsigned int item_id) {
{
ListItem* item = new ListItem(item_id); ListItem* item = new ListItem(item_id);
CriticalSectionScoped lock(critical_section_); CriticalSectionScoped lock(critical_section_);
PushBackImpl(item); PushBackImpl(item);
return 0; return 0;
} }
int ListWrapper::PushFront(const unsigned int item_id) int ListWrapper::PushFront(const unsigned int item_id) {
{
ListItem* item = new ListItem(item_id); ListItem* item = new ListItem(item_id);
CriticalSectionScoped lock(critical_section_); CriticalSectionScoped lock(critical_section_);
PushFrontImpl(item); PushFrontImpl(item);
return 0; return 0;
} }
int ListWrapper::PushFront(const void* ptr) int ListWrapper::PushFront(const void* ptr) {
{
ListItem* item = new ListItem(ptr); ListItem* item = new ListItem(ptr);
CriticalSectionScoped lock(critical_section_); CriticalSectionScoped lock(critical_section_);
PushFrontImpl(item); PushFrontImpl(item);
return 0; return 0;
} }
int ListWrapper::PopFront() int ListWrapper::PopFront() {
{
return Erase(first_); return Erase(first_);
} }
int ListWrapper::PopBack() int ListWrapper::PopBack() {
{
return Erase(last_); return Erase(last_);
} }
ListItem* ListWrapper::First() const ListItem* ListWrapper::First() const {
{
return first_; return first_;
} }
ListItem* ListWrapper::Last() const ListItem* ListWrapper::Last() const {
{
return last_; return last_;
} }
ListItem* ListWrapper::Next(ListItem* item) const ListItem* ListWrapper::Next(ListItem* item) const {
{ if (!item) {
if(!item)
{
return 0; return 0;
} }
return item->next_; return item->next_;
} }
ListItem* ListWrapper::Previous(ListItem* item) const ListItem* ListWrapper::Previous(ListItem* item) const {
{ if (!item) {
if (!item)
{
return 0; return 0;
} }
return item->prev_; return item->prev_;
} }
int ListWrapper::Insert(ListItem* existing_previous_item, ListItem* new_item) int ListWrapper::Insert(ListItem* existing_previous_item, ListItem* new_item) {
{ if (!new_item) {
if (!new_item)
{
return -1; return -1;
} }
// Allow existing_previous_item to be NULL if the list is empty. // Allow existing_previous_item to be NULL if the list is empty.
// TODO(hellner) why allow this? Keep it as is for now to avoid // TODO(hellner) why allow this? Keep it as is for now to avoid
// breaking API contract. // breaking API contract.
if (!existing_previous_item && !Empty()) if (!existing_previous_item && !Empty()) {
{
return -1; return -1;
} }
CriticalSectionScoped lock(critical_section_); CriticalSectionScoped lock(critical_section_);
if (!existing_previous_item) if (!existing_previous_item) {
{
PushBackImpl(new_item); PushBackImpl(new_item);
return 0; return 0;
} }
@ -169,12 +144,9 @@ int ListWrapper::Insert(ListItem* existing_previous_item, ListItem* new_item)
new_item->next_ = existing_previous_item->next_; new_item->next_ = existing_previous_item->next_;
new_item->prev_ = existing_previous_item; new_item->prev_ = existing_previous_item;
existing_previous_item->next_ = new_item; existing_previous_item->next_ = new_item;
if (next_item) if (next_item) {
{
next_item->prev_ = new_item; next_item->prev_ = new_item;
} } else {
else
{
last_ = new_item; last_ = new_item;
} }
size_++; size_++;
@ -182,22 +154,18 @@ int ListWrapper::Insert(ListItem* existing_previous_item, ListItem* new_item)
} }
int ListWrapper::InsertBefore(ListItem* existing_next_item, int ListWrapper::InsertBefore(ListItem* existing_next_item,
ListItem* new_item) ListItem* new_item) {
{ if (!new_item) {
if (!new_item)
{
return -1; return -1;
} }
// Allow existing_next_item to be NULL if the list is empty. // Allow existing_next_item to be NULL if the list is empty.
// Todo: why allow this? Keep it as is for now to avoid breaking API // Todo: why allow this? Keep it as is for now to avoid breaking API
// contract. // contract.
if (!existing_next_item && !Empty()) if (!existing_next_item && !Empty()) {
{
return -1; return -1;
} }
CriticalSectionScoped lock(critical_section_); CriticalSectionScoped lock(critical_section_);
if (!existing_next_item) if (!existing_next_item) {
{
PushBackImpl(new_item); PushBackImpl(new_item);
return 0; return 0;
} }
@ -206,59 +174,44 @@ int ListWrapper::InsertBefore(ListItem* existing_next_item,
new_item->next_ = existing_next_item; new_item->next_ = existing_next_item;
new_item->prev_ = previous_item; new_item->prev_ = previous_item;
existing_next_item->prev_ = new_item; existing_next_item->prev_ = new_item;
if (previous_item) if (previous_item) {
{
previous_item->next_ = new_item; previous_item->next_ = new_item;
} } else {
else
{
first_ = new_item; first_ = new_item;
} }
size_++; size_++;
return 0; return 0;
} }
int ListWrapper::Erase(ListItem* item) int ListWrapper::Erase(ListItem* item) {
{ if (!item) {
if (!item)
{
return -1; return -1;
} }
size_--; size_--;
ListItem* previous_item = item->prev_; ListItem* previous_item = item->prev_;
ListItem* next_item = item->next_; ListItem* next_item = item->next_;
if (!previous_item) if (!previous_item) {
{ if (next_item) {
if(next_item)
{
next_item->prev_ = 0; next_item->prev_ = 0;
} }
first_ = next_item; first_ = next_item;
} } else {
else
{
previous_item->next_ = next_item; previous_item->next_ = next_item;
} }
if (!next_item) if (!next_item) {
{ if (previous_item) {
if(previous_item)
{
previous_item->next_ = 0; previous_item->next_ = 0;
} }
last_ = previous_item; last_ = previous_item;
} } else {
else
{
next_item->prev_ = previous_item; next_item->prev_ = previous_item;
} }
delete item; delete item;
return 0; return 0;
} }
void ListWrapper::PushBackImpl(ListItem* item) void ListWrapper::PushBackImpl(ListItem* item) {
{ if (Empty()) {
if (Empty())
{
first_ = item; first_ = item;
last_ = item; last_ = item;
size_++; size_++;
@ -271,10 +224,8 @@ void ListWrapper::PushBackImpl(ListItem* item)
size_++; size_++;
} }
void ListWrapper::PushFrontImpl(ListItem* item) void ListWrapper::PushFrontImpl(ListItem* item) {
{ if (Empty()) {
if (Empty())
{
first_ = item; first_ = item;
last_ = item; last_ = item;
size_++; size_++;
@ -286,4 +237,5 @@ void ListWrapper::PushFrontImpl(ListItem* item)
first_ = item; first_ = item;
size_++; size_++;
} }
} //namespace webrtc } //namespace webrtc

View File

@ -11,13 +11,13 @@
#ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_NO_STL_H_ #ifndef WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_NO_STL_H_
#define WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_NO_STL_H_ #define WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_NO_STL_H_
#include "constructor_magic.h" #include "webrtc/system_wrappers/interface/constructor_magic.h"
namespace webrtc { namespace webrtc {
class CriticalSectionWrapper; class CriticalSectionWrapper;
class ListNoStlItem class ListNoStlItem {
{
public: public:
ListNoStlItem(const void* ptr); ListNoStlItem(const void* ptr);
ListNoStlItem(const unsigned int item); ListNoStlItem(const unsigned int item);
@ -37,9 +37,7 @@ private:
DISALLOW_COPY_AND_ASSIGN(ListNoStlItem); DISALLOW_COPY_AND_ASSIGN(ListNoStlItem);
}; };
class ListNoStl {
class ListNoStl
{
public: public:
ListNoStl(); ListNoStl();
virtual ~ListNoStl(); virtual ~ListNoStl();
@ -74,6 +72,7 @@ private:
unsigned int size_; unsigned int size_;
DISALLOW_COPY_AND_ASSIGN(ListNoStl); DISALLOW_COPY_AND_ASSIGN(ListNoStl);
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_NO_STL_H_ #endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_NO_STL_H_

View File

@ -8,118 +8,99 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "list_wrapper.h" #include "webrtc/system_wrappers/interface/list_wrapper.h"
#include "trace.h" #include "webrtc/system_wrappers/interface/trace.h"
namespace webrtc { namespace webrtc {
ListItem::ListItem(const void* item) ListItem::ListItem(const void* item)
: this_iter_(), : this_iter_(),
item_ptr_(item), item_ptr_(item),
item_(0) item_(0) {
{
} }
ListItem::ListItem(const unsigned int item) ListItem::ListItem(const unsigned int item)
: this_iter_(), : this_iter_(),
item_ptr_(0), item_ptr_(0),
item_(item) item_(item) {
{
} }
ListItem::~ListItem() ListItem::~ListItem() {
{
} }
void* ListItem::GetItem() const void* ListItem::GetItem() const {
{
return const_cast<void*>(item_ptr_); return const_cast<void*>(item_ptr_);
} }
unsigned int ListItem::GetUnsignedItem() const unsigned int ListItem::GetUnsignedItem() const {
{
return item_; return item_;
} }
ListWrapper::ListWrapper() : list_() ListWrapper::ListWrapper()
{ : list_() {
} }
ListWrapper::~ListWrapper() ListWrapper::~ListWrapper() {
{ if (!Empty()) {
if (!Empty())
{
// TODO(hellner) I'm not sure this loggin is useful. // TODO(hellner) I'm not sure this loggin is useful.
WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1, WEBRTC_TRACE(kTraceMemory, kTraceUtility, -1,
"Potential memory leak in ListWrapper"); "Potential memory leak in ListWrapper");
// Remove all remaining list items. // Remove all remaining list items.
while (Erase(First()) == 0) while (Erase(First()) == 0) {}
{}
} }
} }
bool ListWrapper::Empty() const bool ListWrapper::Empty() const {
{
return list_.empty(); return list_.empty();
} }
unsigned int ListWrapper::GetSize() const unsigned int ListWrapper::GetSize() const {
{
return list_.size(); return list_.size();
} }
int ListWrapper::PushBack(const void* ptr) int ListWrapper::PushBack(const void* ptr) {
{
ListItem* item = new ListItem(ptr); ListItem* item = new ListItem(ptr);
list_.push_back(item); list_.push_back(item);
return 0; return 0;
} }
int ListWrapper::PushBack(const unsigned int item_id) int ListWrapper::PushBack(const unsigned int item_id) {
{
ListItem* item = new ListItem(item_id); ListItem* item = new ListItem(item_id);
list_.push_back(item); list_.push_back(item);
return 0; return 0;
} }
int ListWrapper::PushFront(const unsigned int item_id) int ListWrapper::PushFront(const unsigned int item_id) {
{
ListItem* item = new ListItem(item_id); ListItem* item = new ListItem(item_id);
list_.push_front(item); list_.push_front(item);
return 0; return 0;
} }
int ListWrapper::PushFront(const void* ptr) int ListWrapper::PushFront(const void* ptr) {
{
ListItem* item = new ListItem(ptr); ListItem* item = new ListItem(ptr);
list_.push_front(item); list_.push_front(item);
return 0; return 0;
} }
int ListWrapper::PopFront() int ListWrapper::PopFront() {
{ if (list_.empty()) {
if(list_.empty())
{
return -1; return -1;
} }
list_.pop_front(); list_.pop_front();
return 0; return 0;
} }
int ListWrapper::PopBack() int ListWrapper::PopBack() {
{ if (list_.empty()) {
if(list_.empty())
{
return -1; return -1;
} }
list_.pop_back(); list_.pop_back();
return 0; return 0;
} }
ListItem* ListWrapper::First() const ListItem* ListWrapper::First() const {
{ if (list_.empty()) {
if(list_.empty())
{
return NULL; return NULL;
} }
std::list<ListItem*>::iterator item_iter = list_.begin(); std::list<ListItem*>::iterator item_iter = list_.begin();
@ -128,10 +109,8 @@ ListItem* ListWrapper::First() const
return return_item; return return_item;
} }
ListItem* ListWrapper::Last() const ListItem* ListWrapper::Last() const {
{ if (list_.empty()) {
if(list_.empty())
{
return NULL; return NULL;
} }
// std::list::end() addresses the last item + 1. Decrement so that the // std::list::end() addresses the last item + 1. Decrement so that the
@ -143,16 +122,13 @@ ListItem* ListWrapper::Last() const
return return_item; return return_item;
} }
ListItem* ListWrapper::Next(ListItem* item) const ListItem* ListWrapper::Next(ListItem* item) const {
{ if (item == NULL) {
if(item == NULL)
{
return NULL; return NULL;
} }
std::list<ListItem*>::iterator item_iter = item->this_iter_; std::list<ListItem*>::iterator item_iter = item->this_iter_;
++item_iter; ++item_iter;
if (item_iter == list_.end()) if (item_iter == list_.end()) {
{
return NULL; return NULL;
} }
ListItem* return_item = (*item_iter); ListItem* return_item = (*item_iter);
@ -160,15 +136,12 @@ ListItem* ListWrapper::Next(ListItem* item) const
return return_item; return return_item;
} }
ListItem* ListWrapper::Previous(ListItem* item) const ListItem* ListWrapper::Previous(ListItem* item) const {
{ if (item == NULL) {
if(item == NULL)
{
return NULL; return NULL;
} }
std::list<ListItem*>::iterator item_iter = item->this_iter_; std::list<ListItem*>::iterator item_iter = item->this_iter_;
if (item_iter == list_.begin()) if (item_iter == list_.begin()) {
{
return NULL; return NULL;
} }
--item_iter; --item_iter;
@ -178,27 +151,22 @@ ListItem* ListWrapper::Previous(ListItem* item) const
} }
int ListWrapper::Insert(ListItem* existing_previous_item, int ListWrapper::Insert(ListItem* existing_previous_item,
ListItem* new_item) ListItem* new_item) {
{ // Allow existing_previous_item to be NULL if the list is empty.
// Allow existingPreviousItem to be NULL if the list is empty.
// TODO(hellner) why allow this? Keep it as is for now to avoid // TODO(hellner) why allow this? Keep it as is for now to avoid
// breaking API contract. // breaking API contract.
if (!existing_previous_item && !Empty()) if (!existing_previous_item && !Empty()) {
{
return -1; return -1;
} }
if (!new_item) if (!new_item) {
{
return -1; return -1;
} }
std::list<ListItem*>::iterator insert_location = list_.begin(); std::list<ListItem*>::iterator insert_location = list_.begin();
if (!Empty()) if (!Empty()) {
{
insert_location = existing_previous_item->this_iter_; insert_location = existing_previous_item->this_iter_;
if(insert_location != list_.end()) if (insert_location != list_.end()) {
{
++insert_location; ++insert_location;
} }
} }
@ -208,23 +176,19 @@ int ListWrapper::Insert(ListItem* existing_previous_item,
} }
int ListWrapper::InsertBefore(ListItem* existing_next_item, int ListWrapper::InsertBefore(ListItem* existing_next_item,
ListItem* new_item) ListItem* new_item) {
{
// Allow existing_next_item to be NULL if the list is empty. // Allow existing_next_item to be NULL if the list is empty.
// Todo: why allow this? Keep it as is for now to avoid breaking API // Todo: why allow this? Keep it as is for now to avoid breaking API
// contract. // contract.
if (!existing_next_item && !Empty()) if (!existing_next_item && !Empty()) {
{
return -1; return -1;
} }
if (!new_item) if (!new_item) {
{
return -1; return -1;
} }
std::list<ListItem*>::iterator insert_location = list_.begin(); std::list<ListItem*>::iterator insert_location = list_.begin();
if (!Empty()) if (!Empty()) {
{
insert_location = existing_next_item->this_iter_; insert_location = existing_next_item->this_iter_;
} }
@ -232,13 +196,12 @@ int ListWrapper::InsertBefore(ListItem* existing_next_item,
return 0; return 0;
} }
int ListWrapper::Erase(ListItem* item) int ListWrapper::Erase(ListItem* item) {
{ if (item == NULL) {
if(item == NULL)
{
return -1; return -1;
} }
list_.erase(item->this_iter_); list_.erase(item->this_iter_);
return 0; return 0;
} }
} // namespace webrtc } // namespace webrtc

View File

@ -13,13 +13,11 @@
#include <list> #include <list>
#include "constructor_magic.h" #include "webrtc/system_wrappers/interface/constructor_magic.h"
namespace webrtc { namespace webrtc {
class ListItem
{
friend class ListWrapper;
class ListItem {
public: public:
ListItem(const void* ptr); ListItem(const void* ptr);
ListItem(const unsigned int item); ListItem(const unsigned int item);
@ -28,14 +26,14 @@ public:
unsigned int GetUnsignedItem() const; unsigned int GetUnsignedItem() const;
private: private:
friend class ListWrapper;
mutable std::list<ListItem*>::iterator this_iter_; mutable std::list<ListItem*>::iterator this_iter_;
const void* item_ptr_; const void* item_ptr_;
const unsigned int item_; const unsigned int item_;
DISALLOW_COPY_AND_ASSIGN(ListItem); DISALLOW_COPY_AND_ASSIGN(ListItem);
}; };
class ListWrapper class ListWrapper {
{
public: public:
ListWrapper(); ListWrapper();
~ListWrapper(); ~ListWrapper();
@ -61,6 +59,7 @@ private:
mutable std::list<ListItem*> list_; mutable std::list<ListItem*> list_;
DISALLOW_COPY_AND_ASSIGN(ListWrapper); DISALLOW_COPY_AND_ASSIGN(ListWrapper);
}; };
} // namespace webrtc } // namespace webrtc
#endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_STL_H_ #endif // WEBRTC_SYSTEM_WRAPPERS_SOURCE_LIST_STL_H_

View File

@ -8,10 +8,10 @@
* be found in the AUTHORS file in the root of the source tree. * be found in the AUTHORS file in the root of the source tree.
*/ */
#include "gtest/gtest.h" #include "webrtc/system_wrappers/interface/list_wrapper.h"
#include "system_wrappers/interface/list_wrapper.h" #include "gtest/gtest.h"
#include "system_wrappers/interface/scoped_ptr.h" #include "webrtc/system_wrappers/interface/scoped_ptr.h"
using ::webrtc::ListWrapper; using ::webrtc::ListWrapper;
using ::webrtc::ListItem; using ::webrtc::ListItem;
@ -228,8 +228,7 @@ public:
}; };
ListWrapperSimple* ListWrapperSimple::Create(bool static_allocation) { ListWrapperSimple* ListWrapperSimple::Create(bool static_allocation) {
if(static_allocation) if (static_allocation) {
{
return new ListWrapperStatic(); return new ListWrapperStatic();
} }
return new ListWrapperDynamic(); return new ListWrapperDynamic();
@ -298,8 +297,7 @@ ListWrapperSimple* CreateInterleavedList(bool static_allocation) {
void PrintList(const ListWrapperSimple* list) { void PrintList(const ListWrapperSimple* list) {
ListItem* list_item = list->First(); ListItem* list_item = list->First();
printf("["); printf("[");
while (list_item != NULL) while (list_item != NULL) {
{
printf("%3u", list->GetUnsignedItem(list_item)); printf("%3u", list->GetUnsignedItem(list_item));
list_item = list->Next(list_item); list_item = list->Next(list_item);
} }
@ -404,8 +402,7 @@ TEST(ListWrapperTest,InterLeaveTest) {
unsigned int insert_position = kNumberOfElements / 2; unsigned int insert_position = kNumberOfElements / 2;
ASSERT_EQ(insert_position * 2, kNumberOfElements); ASSERT_EQ(insert_position * 2, kNumberOfElements);
while (!descending_list->Empty()) while (!descending_list->Empty()) {
{
ListItem* item = descending_list->Last(); ListItem* item = descending_list->Last();
ASSERT_FALSE(item == NULL); ASSERT_FALSE(item == NULL);
@ -450,8 +447,7 @@ TEST(ListWrapperTest,InterLeaveTestII) {
unsigned int insert_position = kNumberOfElements / 2; unsigned int insert_position = kNumberOfElements / 2;
ASSERT_EQ(insert_position * 2, kNumberOfElements); ASSERT_EQ(insert_position * 2, kNumberOfElements);
while (!ascending_list->Empty()) while (!ascending_list->Empty()) {
{
ListItem* item = ascending_list->Last(); ListItem* item = ascending_list->Last();
ASSERT_FALSE(item == NULL); ASSERT_FALSE(item == NULL);