summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2008-03-19 17:47:26 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2008-03-19 17:47:26 +0000
commit969acc3d0c24bf4a59e4f37b1378c1b46663a5ad (patch)
treed6b3561d99b89b16e8d3a49366cc200edd30d4b2 /render
parent488520f2b2fd3bd5f640bea6d4f7e4aec47ac0dd (diff)
downloadnetsurf-969acc3d0c24bf4a59e4f37b1378c1b46663a5ad.tar.gz
netsurf-969acc3d0c24bf4a59e4f37b1378c1b46663a5ad.tar.bz2
Re-express table_find_cell algorithm to avoid relying upon side-effects.
svn path=/trunk/netsurf/; revision=3986
Diffstat (limited to 'render')
-rw-r--r--render/table.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/render/table.c b/render/table.c
index ddfe42463..b2fa4cd53 100644
--- a/render/table.c
+++ b/render/table.c
@@ -372,11 +372,19 @@ struct box *table_find_cell(struct box *table, unsigned int x,
if (table->columns <= x || table->rows <= y)
return 0;
- for (row_group = table->children, row = row_group->children;
- row_num != y;
- (row = row->next) || (row_group = row_group->next,
- row = row_group->children), row_num++)
- ;
+ row_group = table->children;
+ row = row_group->children;
+
+ while (row_num != y) {
+ if (row->next) {
+ row = row->next;
+ } else {
+ row_group = row_group->next;
+ row = row_group->children;
+ }
+
+ row_num++;
+ }
for (cell = row->children; cell; cell = cell->next)
if (cell->start_column <= x &&