# HG changeset patch # User Alexander Krotov # Date 1437929046 -10800 # Node ID 68e480bb7d74243214ff05667d73dbe266854ce6 # Parent bdebcc180265dfbc6b0caf566b6b792c08844d85 Remove ByteTagList::IsDirty{Start,End} These functions are only used once and do not save time. Both functions iterate over the whole list just to prevent iterating over the whole list if they return false. As traversing the list is required in any case, these functions can be removed. diff -r bdebcc180265 -r 68e480bb7d74 src/network/model/byte-tag-list.cc --- a/src/network/model/byte-tag-list.cc Sun Aug 02 20:44:01 2015 +0300 +++ b/src/network/model/byte-tag-list.cc Sun Jul 26 19:44:06 2015 +0300 @@ -252,46 +252,10 @@ } } -bool -ByteTagList::IsDirtyAtEnd (int32_t appendOffset) -{ - NS_LOG_FUNCTION (this << appendOffset); - ByteTagList::Iterator i = BeginAll (); - while (i.HasNext ()) - { - ByteTagList::Iterator::Item item = i.Next (); - if (item.end > appendOffset) - { - return true; - } - } - return false; -} - -bool -ByteTagList::IsDirtyAtStart (int32_t prependOffset) -{ - NS_LOG_FUNCTION (this << prependOffset); - ByteTagList::Iterator i = BeginAll (); - while (i.HasNext ()) - { - ByteTagList::Iterator::Item item = i.Next (); - if (item.start < prependOffset) - { - return true; - } - } - return false; -} - void ByteTagList::AddAtEnd (int32_t adjustment, int32_t appendOffset) { NS_LOG_FUNCTION (this << adjustment << appendOffset); - if (adjustment == 0 && !IsDirtyAtEnd (appendOffset)) - { - return; - } ByteTagList list; ByteTagList::Iterator i = BeginAll (); while (i.HasNext ()) @@ -304,14 +268,10 @@ { continue; } - else if (item.start < appendOffset && item.end > appendOffset) + if (item.end > appendOffset) { item.end = appendOffset; } - else - { - // nothing to do. - } TagBuffer buf = list.Add (item.tid, item.size, item.start, item.end); buf.CopyFrom (item.buf); } @@ -322,10 +282,6 @@ ByteTagList::AddAtStart (int32_t adjustment, int32_t prependOffset) { NS_LOG_FUNCTION (this << adjustment << prependOffset); - if (adjustment == 0 && !IsDirtyAtStart (prependOffset)) - { - return; - } ByteTagList list; ByteTagList::Iterator i = BeginAll (); while (i.HasNext ()) @@ -338,14 +294,10 @@ { continue; } - else if (item.end > prependOffset && item.start < prependOffset) + if (item.start < prependOffset) { item.start = prependOffset; } - else - { - // nothing to do. - } TagBuffer buf = list.Add (item.tid, item.size, item.start, item.end); buf.CopyFrom (item.buf); } diff -r bdebcc180265 -r 68e480bb7d74 src/network/model/byte-tag-list.h --- a/src/network/model/byte-tag-list.h Sun Aug 02 20:44:01 2015 +0300 +++ b/src/network/model/byte-tag-list.h Sun Jul 26 19:44:06 2015 +0300 @@ -227,19 +227,6 @@ private: /** - * \brief Check that all offsets are smaller than appendOffset - * \param appendOffset the append offset to check - * \returns true if the check is false - */ - bool IsDirtyAtEnd (int32_t appendOffset); - /** - * \brief Check that all offsets are bigger than prependOffset - * \param prependOffset the prepend offset to check - * \returns true if the check is false - */ - bool IsDirtyAtStart (int32_t prependOffset); - - /** * \brief Returns an iterator pointing to the very first tag in this list. * * \returns an iterator