Use assert() for a condition that should never happen in fairland
If it does happen, assertion failure isn't very nice, but it beats asking the user to report the bug to an inappropriate e-mail address that most probably ceased to work years ago.
This commit is contained in:
parent
4613c6d8f2
commit
17a559b3a5
1 changed files with 3 additions and 6 deletions
|
@ -66,6 +66,7 @@ static int quiet = 0;
|
||||||
/* lower URAN_MIN for more uranium */
|
/* lower URAN_MIN for more uranium */
|
||||||
#define URAN_MIN 56
|
#define URAN_MIN 56
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -688,12 +689,8 @@ new_try(int c)
|
||||||
return i;
|
return i;
|
||||||
i = (i + 1) % secs;
|
i = (i + 1) % secs;
|
||||||
} while (i != starti);
|
} while (i != starti);
|
||||||
if (c < nc) {
|
assert(c >= nc);
|
||||||
printf("fairland: BUG -- couldn't find coast for continent %c, sector %d.\nPlease mail stevens@math.utoronto.ca.\n",
|
return -1;
|
||||||
c + 'a', secs);
|
|
||||||
exit(1);
|
|
||||||
} else
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue