sweep.c: Move repeated call out of if ... else