aboutsummaryrefslogtreecommitdiffstats
path: root/FICS/ratings.c
diff options
context:
space:
mode:
Diffstat (limited to 'FICS/ratings.c')
-rw-r--r--FICS/ratings.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/FICS/ratings.c b/FICS/ratings.c
index 8fd683c..5f06ccc 100644
--- a/FICS/ratings.c
+++ b/FICS/ratings.c
@@ -1304,6 +1304,18 @@ com_statistics(int p, param_list param)
return COM_OK;
}
+/*
+ * Return the difference of 'a - b'
+ */
+PUBLIC int
+int_diff(const char *fn, const int a, const int b)
+{
+ if ((b > 0 && a < INT_MIN + b) ||
+ (b < 0 && a > INT_MAX + b))
+ errx(1, "%s: integer overflow (%d - %d)", fn, a, b);
+ return (a - b);
+}
+
PUBLIC int
com_fixrank(int p, param_list param)
{