[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:58:38 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 1ff61aef6753b43903287163b31837a95e1d3f4a
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Sun Mar 24 23:06:40 2002 +0000
Add tail pointer to KWQListImpl, since that shows up on so many profiles.
* src/kwq/KWQListImpl.mm: (KWQListImpl::KWQListPrivate::copyList): Return
a tail pointer too.
(KWQListImpl::KWQListPrivate::KWQListPrivate): Set up tail pointer.
(KWQListImpl::clear): Clean tail pointer too.
(KWQListImpl::at): Special case the tail so we don't walk the whole list
when we ask for the last element.
(KWQListImpl::insert): Update the tail node to when inserting. Also add
a special case for adding at the end so we don't walk the whole list.
(KWQListImpl::remove): Update the tail node. Also, use at() in the index-
based remove so we don't ahve to replicate the logic about finding a
node with the special case for the tail.
(KWQListImpl::getLast): Trivial now.
(KWQListImpl::last): Trivial now.
(KWQListIteratorImpl::toLast): Trivial now.
* src/kwq/KWQString.mm: (QString::operator=): Remove unneeded line of code.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@835 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index 24458d0..a3c1e9c 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,24 @@
+2002-03-24 Darin Adler <darin at apple.com>
+
+ Add tail pointer to KWQListImpl, since that shows up on so many profiles.
+
+ * src/kwq/KWQListImpl.mm: (KWQListImpl::KWQListPrivate::copyList): Return
+ a tail pointer too.
+ (KWQListImpl::KWQListPrivate::KWQListPrivate): Set up tail pointer.
+ (KWQListImpl::clear): Clean tail pointer too.
+ (KWQListImpl::at): Special case the tail so we don't walk the whole list
+ when we ask for the last element.
+ (KWQListImpl::insert): Update the tail node to when inserting. Also add
+ a special case for adding at the end so we don't walk the whole list.
+ (KWQListImpl::remove): Update the tail node. Also, use at() in the index-
+ based remove so we don't ahve to replicate the logic about finding a
+ node with the special case for the tail.
+ (KWQListImpl::getLast): Trivial now.
+ (KWQListImpl::last): Trivial now.
+ (KWQListIteratorImpl::toLast): Trivial now.
+
+ * src/kwq/KWQString.mm: (QString::operator=): Remove unneeded line of code.
+
2002-03-24 Richard Williamson <rjw at apple.com>
A number of fixes to support non-latin1 decoding
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index 24458d0..a3c1e9c 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,24 @@
+2002-03-24 Darin Adler <darin at apple.com>
+
+ Add tail pointer to KWQListImpl, since that shows up on so many profiles.
+
+ * src/kwq/KWQListImpl.mm: (KWQListImpl::KWQListPrivate::copyList): Return
+ a tail pointer too.
+ (KWQListImpl::KWQListPrivate::KWQListPrivate): Set up tail pointer.
+ (KWQListImpl::clear): Clean tail pointer too.
+ (KWQListImpl::at): Special case the tail so we don't walk the whole list
+ when we ask for the last element.
+ (KWQListImpl::insert): Update the tail node to when inserting. Also add
+ a special case for adding at the end so we don't walk the whole list.
+ (KWQListImpl::remove): Update the tail node. Also, use at() in the index-
+ based remove so we don't ahve to replicate the logic about finding a
+ node with the special case for the tail.
+ (KWQListImpl::getLast): Trivial now.
+ (KWQListImpl::last): Trivial now.
+ (KWQListIteratorImpl::toLast): Trivial now.
+
+ * src/kwq/KWQString.mm: (QString::operator=): Remove unneeded line of code.
+
2002-03-24 Richard Williamson <rjw at apple.com>
A number of fixes to support non-latin1 decoding
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 24458d0..a3c1e9c 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,24 @@
+2002-03-24 Darin Adler <darin at apple.com>
+
+ Add tail pointer to KWQListImpl, since that shows up on so many profiles.
+
+ * src/kwq/KWQListImpl.mm: (KWQListImpl::KWQListPrivate::copyList): Return
+ a tail pointer too.
+ (KWQListImpl::KWQListPrivate::KWQListPrivate): Set up tail pointer.
+ (KWQListImpl::clear): Clean tail pointer too.
+ (KWQListImpl::at): Special case the tail so we don't walk the whole list
+ when we ask for the last element.
+ (KWQListImpl::insert): Update the tail node to when inserting. Also add
+ a special case for adding at the end so we don't walk the whole list.
+ (KWQListImpl::remove): Update the tail node. Also, use at() in the index-
+ based remove so we don't ahve to replicate the logic about finding a
+ node with the special case for the tail.
+ (KWQListImpl::getLast): Trivial now.
+ (KWQListImpl::last): Trivial now.
+ (KWQListIteratorImpl::toLast): Trivial now.
+
+ * src/kwq/KWQString.mm: (QString::operator=): Remove unneeded line of code.
+
2002-03-24 Richard Williamson <rjw at apple.com>
A number of fixes to support non-latin1 decoding
diff --git a/WebCore/kwq/KWQListImpl.mm b/WebCore/kwq/KWQListImpl.mm
index 40461c4..278d627 100644
--- a/WebCore/kwq/KWQListImpl.mm
+++ b/WebCore/kwq/KWQListImpl.mm
@@ -53,9 +53,7 @@ public:
KWQListNode::~KWQListNode()
{
- if (next != NULL) {
- delete next;
- }
+ delete next;
}
// KWQListImpl::KWQListPrivate
@@ -67,17 +65,17 @@ public:
KWQListPrivate(KWQListPrivate &vp);
~KWQListPrivate();
- static KWQListNode *copyList(KWQListNode *l);
+ static KWQListNode * copyList(KWQListNode *, KWQListNode *&tail);
KWQListNode *head;
- // KWQListNode *tail;
+ KWQListNode *tail;
KWQListNode *current;
uint count;
void (*deleteItem)(void *);
KWQListNode *iterators;
};
-KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
+KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l, KWQListNode *&tail)
{
KWQListNode *node = l;
KWQListNode *copyHead = NULL;
@@ -99,11 +97,13 @@ KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
node = node->next;
}
+ tail = last;
return copyHead;
}
KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
head(NULL),
+ tail(NULL),
current(NULL),
count(0),
deleteItem(deleteFunc),
@@ -112,12 +112,12 @@ KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
}
KWQListImpl::KWQListPrivate::KWQListPrivate(KWQListPrivate &vp) :
- head(copyList(vp.head)),
current(NULL),
count(vp.count),
deleteItem(vp.deleteItem),
iterators(NULL)
{
+ head = copyList(vp.head, tail);
}
KWQListImpl::KWQListPrivate::~KWQListPrivate()
@@ -191,6 +191,7 @@ void KWQListImpl::clear(bool deleteItems)
delete d->head;
d->head = NULL;
+ d->tail = NULL;
d->current = NULL;
d->count = 0;
}
@@ -275,15 +276,18 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
void *KWQListImpl::at(uint n)
{
- d->current = d->head;
- uint i = 0;
-
- while (i < n && d->current != NULL) {
- d->current = d->current->next;
- i++;
+ KWQListNode *node;
+ if (n >= d->count - 1) {
+ node = d->tail;
+ } else {
+ node = d->head;
+ for (uint i = 0; i < n && node != NULL; i++) {
+ node = node->next;
+ }
}
- return d->current->data;
+ d->current = node;
+ return node->data;
}
bool KWQListImpl::insert(uint n, const void *item)
@@ -292,74 +296,86 @@ bool KWQListImpl::insert(uint n, const void *item)
return false;
}
- d->current = new KWQListNode;
- d->current->data = (void *)item;
+ KWQListNode *node = new KWQListNode;
+ node->data = (void *)item;
if (n == 0) {
// inserting at head
- d->current->next = d->head;
+ node->next = d->head;
if (d->head != NULL) {
- d->head->prev = d->current;
+ d->head->prev = node;
}
- d->head = d->current;
+ d->head = node;
+ if (d->tail == NULL) {
+ d->tail = node;
+ }
+ } else if (n == d->count) {
+ // inserting at tail
+ node->prev = d->tail;
+ if (d->tail != NULL) {
+ d->tail->next = node;
+ }
+ d->tail = node;
} else {
// general insertion
// iterate to one node before the insertion point, can't be null
- // since we know n > 0 and n <= d->count
+ // since we know n > 0 and n < d->count
KWQListNode *node = d->head;
- for (unsigned i = 0; i < n - 1; i++) {
+ for (uint i = 0; i < n - 1; i++) {
node = node->next;
}
- d->current->prev = node;
- d->current->next = node->next;
+ node->prev = node;
+ node->next = node->next;
if (node->next != NULL) {
- node->next->prev = d->current;
+ node->next->prev = node;
}
- node->next = d->current;
+ node->next = node;
}
d->count++;
+ d->current = node;
return true;
}
bool KWQListImpl::remove(bool deleteItem)
{
- if (d->current == NULL) {
+ KWQListNode *node = d->current;
+ if (node == NULL) {
return false;
}
- if (d->head == d->current) {
- d->head = d->current->next;
+ if (node->prev == NULL) {
+ d->head = node->next;
} else {
- d->current->prev->next = d->current->next;
+ node->prev->next = node->next;
}
- if (d->current->next != NULL) {
- d->current->next->prev = d->current->prev;
+ if (node->next == NULL) {
+ d->tail = node->prev;
+ } else {
+ node->next->prev = node->prev;
}
- KWQListNode *detached = d->current;
- if (detached->next != NULL) {
- d->current = detached->next;
+ if (node->next != NULL) {
+ d->current = node->next;
} else {
- d->current = detached->prev;
+ d->current = node->prev;
}
- detached->next = NULL;
-
if (deleteItem) {
- d->deleteItem(detached->data);
+ d->deleteItem(node->data);
}
for (KWQListNode *iterator = d->iterators; iterator != NULL; iterator = iterator->next) {
- if (((KWQListIteratorImpl *)iterator->data)->d->node == detached) {
+ if (((KWQListIteratorImpl *)iterator->data)->d->node == node) {
((KWQListIteratorImpl *)iterator->data)->d->node = d->current;
}
}
-
- delete detached;
+
+ node->next = NULL;
+ delete node;
d->count--;
return true;
@@ -370,19 +386,14 @@ bool KWQListImpl::remove(uint n, bool deleteItem)
if (n >= d->count) {
return false;
}
-
- d->current = d->head;
-
- for (uint i = 0; i < n; i++) {
- d->current = d->current->next;
- }
+ at(n);
return remove(deleteItem);
}
bool KWQListImpl::removeFirst(bool deleteItem)
{
- return remove((unsigned)0, deleteItem);
+ return remove(0, deleteItem);
}
bool KWQListImpl::removeLast(bool deleteItem)
@@ -435,16 +446,7 @@ void *KWQListImpl::getFirst() const
void *KWQListImpl::getLast() const
{
- KWQListNode *node = d->head;
-
- if (node == NULL) {
- return NULL;
- }
-
- while (node->next != NULL) {
- node = node->next;
- }
- return node->data;
+ return d->tail->data;
}
void *KWQListImpl::current() const
@@ -464,12 +466,7 @@ void *KWQListImpl::first()
void *KWQListImpl::last()
{
- if (d->head != NULL) {
- d->current = d->head;
- while (d->current->next != NULL) {
- d->current = d->current->next;
- }
- }
+ d->current = d->tail;
return current();
}
@@ -527,6 +524,8 @@ uint KWQListImpl::containsRef(const void *item) const
KWQListImpl &KWQListImpl::assign(const KWQListImpl &impl, bool deleteItems)
{
+ // FIXME: this doesn't respect the deleteItems flag
+
KWQListImpl tmp(impl);
KWQListImpl::KWQListPrivate *tmpD = tmp.d;
@@ -536,7 +535,6 @@ KWQListImpl &KWQListImpl::assign(const KWQListImpl &impl, bool deleteItems)
return *this;
}
-
void KWQListImpl::addIterator(KWQListIteratorImpl *iter) const
{
KWQListNode *node = new KWQListNode();
@@ -616,10 +614,7 @@ void *KWQListIteratorImpl::toFirst()
void *KWQListIteratorImpl::toLast()
{
- d->node = d->list->d->head;
- while (d->node != NULL && d->node->next != NULL) {
- d->node = d->node->next;
- }
+ d->node = d->list->d->tail;
return current();
}
diff --git a/WebCore/kwq/KWQString.mm b/WebCore/kwq/KWQString.mm
index b86b3dd..406afc8 100644
--- a/WebCore/kwq/KWQString.mm
+++ b/WebCore/kwq/KWQString.mm
@@ -258,7 +258,6 @@ QString &QString::operator=(const QString &qs)
CFRelease(s);
s = qs.s;
flushCache();
- cache = NULL;
return *this;
}
diff --git a/WebCore/src/kwq/KWQListImpl.mm b/WebCore/src/kwq/KWQListImpl.mm
index 40461c4..278d627 100644
--- a/WebCore/src/kwq/KWQListImpl.mm
+++ b/WebCore/src/kwq/KWQListImpl.mm
@@ -53,9 +53,7 @@ public:
KWQListNode::~KWQListNode()
{
- if (next != NULL) {
- delete next;
- }
+ delete next;
}
// KWQListImpl::KWQListPrivate
@@ -67,17 +65,17 @@ public:
KWQListPrivate(KWQListPrivate &vp);
~KWQListPrivate();
- static KWQListNode *copyList(KWQListNode *l);
+ static KWQListNode * copyList(KWQListNode *, KWQListNode *&tail);
KWQListNode *head;
- // KWQListNode *tail;
+ KWQListNode *tail;
KWQListNode *current;
uint count;
void (*deleteItem)(void *);
KWQListNode *iterators;
};
-KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
+KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l, KWQListNode *&tail)
{
KWQListNode *node = l;
KWQListNode *copyHead = NULL;
@@ -99,11 +97,13 @@ KWQListNode *KWQListImpl::KWQListPrivate::copyList(KWQListNode *l)
node = node->next;
}
+ tail = last;
return copyHead;
}
KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
head(NULL),
+ tail(NULL),
current(NULL),
count(0),
deleteItem(deleteFunc),
@@ -112,12 +112,12 @@ KWQListImpl::KWQListPrivate::KWQListPrivate(void (*deleteFunc)(void *)) :
}
KWQListImpl::KWQListPrivate::KWQListPrivate(KWQListPrivate &vp) :
- head(copyList(vp.head)),
current(NULL),
count(vp.count),
deleteItem(vp.deleteItem),
iterators(NULL)
{
+ head = copyList(vp.head, tail);
}
KWQListImpl::KWQListPrivate::~KWQListPrivate()
@@ -191,6 +191,7 @@ void KWQListImpl::clear(bool deleteItems)
delete d->head;
d->head = NULL;
+ d->tail = NULL;
d->current = NULL;
d->count = 0;
}
@@ -275,15 +276,18 @@ void KWQListImpl::sort(int (*compareFunc)(void *a, void *b, void *data), void *d
void *KWQListImpl::at(uint n)
{
- d->current = d->head;
- uint i = 0;
-
- while (i < n && d->current != NULL) {
- d->current = d->current->next;
- i++;
+ KWQListNode *node;
+ if (n >= d->count - 1) {
+ node = d->tail;
+ } else {
+ node = d->head;
+ for (uint i = 0; i < n && node != NULL; i++) {
+ node = node->next;
+ }
}
- return d->current->data;
+ d->current = node;
+ return node->data;
}
bool KWQListImpl::insert(uint n, const void *item)
@@ -292,74 +296,86 @@ bool KWQListImpl::insert(uint n, const void *item)
return false;
}
- d->current = new KWQListNode;
- d->current->data = (void *)item;
+ KWQListNode *node = new KWQListNode;
+ node->data = (void *)item;
if (n == 0) {
// inserting at head
- d->current->next = d->head;
+ node->next = d->head;
if (d->head != NULL) {
- d->head->prev = d->current;
+ d->head->prev = node;
}
- d->head = d->current;
+ d->head = node;
+ if (d->tail == NULL) {
+ d->tail = node;
+ }
+ } else if (n == d->count) {
+ // inserting at tail
+ node->prev = d->tail;
+ if (d->tail != NULL) {
+ d->tail->next = node;
+ }
+ d->tail = node;
} else {
// general insertion
// iterate to one node before the insertion point, can't be null
- // since we know n > 0 and n <= d->count
+ // since we know n > 0 and n < d->count
KWQListNode *node = d->head;
- for (unsigned i = 0; i < n - 1; i++) {
+ for (uint i = 0; i < n - 1; i++) {
node = node->next;
}
- d->current->prev = node;
- d->current->next = node->next;
+ node->prev = node;
+ node->next = node->next;
if (node->next != NULL) {
- node->next->prev = d->current;
+ node->next->prev = node;
}
- node->next = d->current;
+ node->next = node;
}
d->count++;
+ d->current = node;
return true;
}
bool KWQListImpl::remove(bool deleteItem)
{
- if (d->current == NULL) {
+ KWQListNode *node = d->current;
+ if (node == NULL) {
return false;
}
- if (d->head == d->current) {
- d->head = d->current->next;
+ if (node->prev == NULL) {
+ d->head = node->next;
} else {
- d->current->prev->next = d->current->next;
+ node->prev->next = node->next;
}
- if (d->current->next != NULL) {
- d->current->next->prev = d->current->prev;
+ if (node->next == NULL) {
+ d->tail = node->prev;
+ } else {
+ node->next->prev = node->prev;
}
- KWQListNode *detached = d->current;
- if (detached->next != NULL) {
- d->current = detached->next;
+ if (node->next != NULL) {
+ d->current = node->next;
} else {
- d->current = detached->prev;
+ d->current = node->prev;
}
- detached->next = NULL;
-
if (deleteItem) {
- d->deleteItem(detached->data);
+ d->deleteItem(node->data);
}
for (KWQListNode *iterator = d->iterators; iterator != NULL; iterator = iterator->next) {
- if (((KWQListIteratorImpl *)iterator->data)->d->node == detached) {
+ if (((KWQListIteratorImpl *)iterator->data)->d->node == node) {
((KWQListIteratorImpl *)iterator->data)->d->node = d->current;
}
}
-
- delete detached;
+
+ node->next = NULL;
+ delete node;
d->count--;
return true;
@@ -370,19 +386,14 @@ bool KWQListImpl::remove(uint n, bool deleteItem)
if (n >= d->count) {
return false;
}
-
- d->current = d->head;
-
- for (uint i = 0; i < n; i++) {
- d->current = d->current->next;
- }
+ at(n);
return remove(deleteItem);
}
bool KWQListImpl::removeFirst(bool deleteItem)
{
- return remove((unsigned)0, deleteItem);
+ return remove(0, deleteItem);
}
bool KWQListImpl::removeLast(bool deleteItem)
@@ -435,16 +446,7 @@ void *KWQListImpl::getFirst() const
void *KWQListImpl::getLast() const
{
- KWQListNode *node = d->head;
-
- if (node == NULL) {
- return NULL;
- }
-
- while (node->next != NULL) {
- node = node->next;
- }
- return node->data;
+ return d->tail->data;
}
void *KWQListImpl::current() const
@@ -464,12 +466,7 @@ void *KWQListImpl::first()
void *KWQListImpl::last()
{
- if (d->head != NULL) {
- d->current = d->head;
- while (d->current->next != NULL) {
- d->current = d->current->next;
- }
- }
+ d->current = d->tail;
return current();
}
@@ -527,6 +524,8 @@ uint KWQListImpl::containsRef(const void *item) const
KWQListImpl &KWQListImpl::assign(const KWQListImpl &impl, bool deleteItems)
{
+ // FIXME: this doesn't respect the deleteItems flag
+
KWQListImpl tmp(impl);
KWQListImpl::KWQListPrivate *tmpD = tmp.d;
@@ -536,7 +535,6 @@ KWQListImpl &KWQListImpl::assign(const KWQListImpl &impl, bool deleteItems)
return *this;
}
-
void KWQListImpl::addIterator(KWQListIteratorImpl *iter) const
{
KWQListNode *node = new KWQListNode();
@@ -616,10 +614,7 @@ void *KWQListIteratorImpl::toFirst()
void *KWQListIteratorImpl::toLast()
{
- d->node = d->list->d->head;
- while (d->node != NULL && d->node->next != NULL) {
- d->node = d->node->next;
- }
+ d->node = d->list->d->tail;
return current();
}
diff --git a/WebCore/src/kwq/KWQString.mm b/WebCore/src/kwq/KWQString.mm
index b86b3dd..406afc8 100644
--- a/WebCore/src/kwq/KWQString.mm
+++ b/WebCore/src/kwq/KWQString.mm
@@ -258,7 +258,6 @@ QString &QString::operator=(const QString &qs)
CFRelease(s);
s = qs.s;
flushCache();
- cache = NULL;
return *this;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list