From a52f3609634bf1b404480c14e8f77040e6277fb1 Mon Sep 17 00:00:00 2001 From: Stefans Mezulis Date: Sun, 25 Feb 2018 21:34:01 +0000 Subject: [PATCH 1/2] Add bounds check to randrange Preivously, we would get an assertion error if COLORS == 1. --- src/util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util.c b/src/util.c index e331adb..5ce30e2 100644 --- a/src/util.c +++ b/src/util.c @@ -7,6 +7,9 @@ ///Get a random integer in the range [lo, hi). int randrange(int lo, int hi){ + assert(lo <= hi /* Negative range not allowed. */); + if(lo == hi) + return lo; return randint(lo, hi - 1); } From 10f7fe541d5e02265d883dcbaec8616b9bbdc1a8 Mon Sep 17 00:00:00 2001 From: Stefans Mezulis Date: Sun, 25 Feb 2018 21:36:06 +0000 Subject: [PATCH 2/2] Add search for librt to configure.ac --- configure.ac | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.ac b/configure.ac index b6a238f..1d464a7 100644 --- a/configure.ac +++ b/configure.ac @@ -36,8 +36,12 @@ WARN_CFLAGS=$(AS_ECHO(["$WARN_CFLAGS"]) | dnl $SED 's/-W\(error=\)\?declaration-after-statement *//g') AC_SUBST([WARN_CFLAGS]) +# OSX requires linking against libiconv AC_SEARCH_LIBS([iconv], [iconv], [], [AC_MSG_ERROR(["iconv is required for locale conversion"])]) +# Some systems require librt for clock_gettime +AC_SEARCH_LIBS([clock_gettime], [rt], [], + [AC_MSG_ERROR(["clock_gettime is required for timing"])]) # Use noreturn attribute if available AC_CHECK_HEADERS_ONCE([stdnoreturn.h])