diff options
author | Christopher James Lahey <clahey@ximian.com> | 2001-10-30 04:36:24 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2001-10-30 04:36:24 +0800 |
commit | aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac (patch) | |
tree | f479642f4b221fdf278578624c2dc71e04425a51 /widgets/table/e-tree-sorted.c | |
parent | f828accd314674f31de652bf4cd5d0b5e136f9ab (diff) | |
download | gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.gz gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.tar.zst gsoc2013-evolution-aa1899af14ef8c2792b5c25b3aef6f5b6a9a92ac.zip |
Don't go outside the table looking for matches when doing the last_access
2001-10-29 Christopher James Lahey <clahey@ximian.com>
* e-table-subset.c (etss_get_view_row), e-tree-sorted.c
(check_last_access), e-tree-table-adapter.c (find_row_num): Don't
go outside the table looking for matches when doing the
last_access search.
svn path=/trunk/; revision=14359
Diffstat (limited to 'widgets/table/e-tree-sorted.c')
-rw-r--r-- | widgets/table/e-tree-sorted.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c index 25e82738fb..f86bca0a06 100644 --- a/widgets/table/e-tree-sorted.c +++ b/widgets/table/e-tree-sorted.c @@ -164,9 +164,6 @@ check_last_access (ETreeSorted *ets, ETreePath corresponding) { #ifdef CHECK_AROUND_LAST_ACCESS ETreeSortedPath *parent; - int end; - int start; - int i; #endif if (ets->priv->last_access == NULL) @@ -180,18 +177,20 @@ check_last_access (ETreeSorted *ets, ETreePath corresponding) #ifdef CHECK_AROUND_LAST_ACCESS parent = ets->priv->last_access->parent; if (parent && parent->children) { - i = ets->priv->last_access->position; - end = MIN(parent->num_children, i + 10); - for (; i < end; i++) { + int position = ets->priv->last_access->position; + int end = MIN(parent->num_children, position + 10); + int start = MAX(0, position - 10); + int initial = MAX (MIN (position, end), start); + int i; + + for (i = initial + 1; i < end; i++) { if (parent->children[i] && parent->children[i]->corresponding == corresponding) { d(g_print("Found last access %p at %p.", ets->priv->last_access, parent->children[i])); return parent->children[i]; } } - i = ets->priv->last_access->position - 1; - start = MAX(0, i - 10); - for (; i >= start; i--) { + for (i = initial - 1; i >= start; i--) { if (parent->children[i] && parent->children[i]->corresponding == corresponding) { d(g_print("Found last access %p at %p.", ets->priv->last_access, parent->children[i])); return parent->children[i]; |