From 07c3c06f59348c5558c909b2aa10734bf95e62e7 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 7 Jul 2016 23:50:39 -0400 Subject: Make serd_strtod API const-correct This is an API breakage, but a minor one (particularly since NULL is allowed) that avoids the flaw in the C API. --- tests/serd_test.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/serd_test.c b/tests/serd_test.c index c2d70136..6f041e2d 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -39,11 +39,13 @@ test_strtod(double dbl, double max_delta) char buf[1024]; snprintf(buf, sizeof(buf), "%f", dbl); - char* endptr = NULL; - const double out = serd_strtod(buf, &endptr); + size_t end = 0; + const double out = serd_strtod(buf, &end); const double diff = fabs(out - dbl); assert(diff <= max_delta); + assert(end == strlen(buf)); + return 0; } -- cgit v1.2.1