Fix test/c/testlib 'const char *' vs 'char *'
Prior to this commit, `g++ test/c/std/png.c` failed with:
test/c/std/../testlib/testlib.c:107:14: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
...
test/c/std/../testlib/testlib.c:741:5: note: in expansion of macro ‘RETURN_FAIL’
741 | RETURN_FAIL("hex_dump: NULL argument");
Likewise, clang++ also failed with:
test/c/std/../testlib/testlib.c:741:5: error: cannot initialize return object of type 'char *' with an rvalue of type 'const char *'
RETURN_FAIL("hex_dump: NULL argument");
Also run "clang-format-9 -style=Chromium"
diff --git a/test/c/testlib/testlib.c b/test/c/testlib/testlib.c
index 9b099cc..b6aebbf 100644
--- a/test/c/testlib/testlib.c
+++ b/test/c/testlib/testlib.c
@@ -105,7 +105,7 @@
#define RETURN_FAIL(...) \
return (snprintf(g_fail_msg, sizeof(g_fail_msg), ##__VA_ARGS__) >= 0) \
? g_fail_msg \
- : "unknown failure (snprintf-related)"
+ : strcpy(g_fail_msg, "unknown failure (snprintf-related)")
#define INCR_FAIL(msg, ...) \
msg += snprintf(msg, sizeof(g_fail_msg) - (msg - g_fail_msg), ##__VA_ARGS__)
@@ -422,7 +422,8 @@
"compatible with the\n"
"# https://godoc.org/golang.org/x/perf/cmd/benchstat tool. To install "
"it, first\n"
- "# install Go, then run \"go install golang.org/x/perf/cmd/benchstat\".\n");
+ "# install Go, then run \"go install "
+ "golang.org/x/perf/cmd/benchstat\".\n");
}
for (int i = 0; i < reps; i++) {