citrun

watch C/C++ source code execute
Log | Files | Refs | LICENSE

commit 98262c2f33bed646a8c0a6bef67d5a576783d666
parent f3d37292823d3783eb32e6d1a65c06b72c6d00dd
Author: Kyle Milz <kyle@0x30.net>
Date:   Sun, 26 Jun 2016 23:28:00 -0600

lib: fix some iffy code, pointed out by clang

Diffstat:
Mlib/runtime.c | 8++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/runtime.c b/lib/runtime.c @@ -132,7 +132,7 @@ send_static(int fd) xwrite(fd, &pids[i], sizeof(pid_t)); /* Send static object file information. */ - for (i = 0, w = nodes_head; i < nodes_total, w != NULL; i++, w = w->next) { + for (i = 0, w = nodes_head; i < nodes_total && w != NULL; i++, w = w->next) { node = *w; /* Length of the original source file name. */ @@ -150,7 +150,7 @@ send_static(int fd) } if (i != nodes_total) - warnx("tu chain inconsistent: %i vs %i", i, nodes_total); + warnx("tu chain inconsistent: %i vs %llu", i, nodes_total); if (w != NULL) warnx("tu chain is longer than before"); } @@ -165,11 +165,11 @@ send_dynamic(int fd) int i; /* Write execution buffers (one 8 byte counter per source line). */ - for (i = 0, w = nodes_head; i < nodes_total, w != NULL; i++, w = w->next) + for (i = 0, w = nodes_head; i < nodes_total && w != NULL; i++, w = w->next) xwrite(fd, w->lines_ptr, w->size * sizeof(uint64_t)); if (i != nodes_total) - warnx("tu chain inconsistent: %i vs %i", i, nodes_total); + warnx("tu chain inconsistent: %i vs %llu", i, nodes_total); if (w != NULL) warnx("tu chain is longer than before"); }