From 07ae1e4fb9a1fd9d6ce9c48c5300b53e87303937 Mon Sep 17 00:00:00 2001 From: Mustapha Senhaji Date: Thu, 19 Feb 2009 23:51:47 +0000 Subject: FS#9930 by Joshua Simmons: Code clean up the goban plugin a bit, mostly by improving comments. No functional changes. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20060 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/goban/board.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'apps/plugins/goban/board.c') diff --git a/apps/plugins/goban/board.c b/apps/plugins/goban/board.c index bc6c5347dc..c36fcc56e9 100644 --- a/apps/plugins/goban/board.c +++ b/apps/plugins/goban/board.c @@ -55,7 +55,13 @@ static int flood_fill_helper (unsigned short pos, unsigned char orig_color, /* these aren't "board marks" in the marks on the SGF sense, they are used internally to mark already visited points and the like (such as when - doing liberty counting for groups) */ + doing liberty counting for groups) + + We avoid having to clear the entire array every time by storing the + "current_mark" number and defining marked as "== current_mark". We + still need to clear the whole array once per "cycle" though, or we'd get + false positives sometimes + */ static void setup_marks (void) { @@ -92,13 +98,10 @@ is_marked (unsigned short pos) void clear_board (void) { - unsigned int i, x, y; + unsigned int x, y; /* for the borders */ - for (i = 0; i < (2 + MAX_BOARD_SIZE) * (2 + MAX_BOARD_SIZE); ++i) - { - board_data[i] = INVALID; - } + rb->memset(board_data, INVALID, sizeof(board_data)); /* now make the actual board part */ for (y = 0; y < board_height; ++y) -- cgit v1.2.3