From 969acc3d0c24bf4a59e4f37b1378c1b46663a5ad Mon Sep 17 00:00:00 2001 From: John Mark Bell Date: Wed, 19 Mar 2008 17:47:26 +0000 Subject: Re-express table_find_cell algorithm to avoid relying upon side-effects. svn path=/trunk/netsurf/; revision=3986 --- render/table.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'render/table.c') 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 && -- cgit v1.2.3