From: Richard Kettlewell Date: Sun, 13 Sep 2015 11:06:02 +0000 (+0100) Subject: Tinker with loop bounding to placate GCC 5.2.1 X-Git-Tag: 5.2~77 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/commitdiff_plain/63888cfaf550151ddb8755ba9961015cdbcdfb07?ds=sidebyside Tinker with loop bounding to placate GCC 5.2.1 --- diff --git a/tests/udplog.c b/tests/udplog.c index d326dbb..6c817ce 100644 --- a/tests/udplog.c +++ b/tests/udplog.c @@ -134,12 +134,13 @@ int main(int argc, char **argv) { disorder_fatal(0, "getnameinfo: %s", gai_strerror(err)); xprintf("from host %s service %s: %d bytes\n", h, s, n); for(i = 0; i < n; i += 16) { - for(j = i; j < n && j < i + 16; ++j) + const int limit = n > i + 16 ? i + 16 : n; + for(j = i; j < limit; ++j) xprintf(" %02x", buffer[j]); for(; j < i + 16; ++j) xprintf(" "); xprintf(" "); - for(j = i; j < n && j < i + 16; ++j) + for(j = i; j < limit; ++j) xprintf("%c", buffer[j] < 128 && isprint(buffer[j]) ? buffer[j] : '.'); xprintf("\n"); if(fflush(stdout) < 0)