From 00c7fe7bb9b7c409c3922431c9fefd348e4f8346 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 14 Aug 2020 13:46:00 +0200 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 standard C API. --- tests/serd_test.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/serd_test.c b/tests/serd_test.c index ab0a0896..a8853969 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -40,11 +40,12 @@ 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)); } typedef struct { -- cgit v1.2.1