+ else {
+ int rt = dsf_canonify(ds->dsf_scratch, i), j;
+ for (j = 0; j < w*h; ++j) {
+ int k;
+ if (dsf_canonify(ds->dsf_scratch, j) != rt) continue;
+ for (k = 0; k < 4; ++k) {
+ const int xx = j % w + dx[k], yy = j / w + dy[k];
+ if (xx >= 0 && xx < w && yy >= 0 && yy < h &&
+ state->board[yy*w + xx] == EMPTY)
+ goto noflag;
+ }
+ }
+ flags |= ERROR_BG;
+ noflag:
+ ;
+ }