Skip to content

Commit

Permalink
Tinker with loop bounding to placate GCC 5.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ewxrjk committed Sep 13, 2015
1 parent 8d2f469 commit 63888cf
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/udplog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

1 comment on commit 63888cf

@ewxrjk
Copy link
Owner Author

@ewxrjk ewxrjk commented on 63888cf Sep 13, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.