diff options
author | David Robillard <d@drobilla.net> | 2016-07-07 23:50:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2018-12-30 17:56:22 -0500 |
commit | 86681fbf464d47f8962238d472a7d521643d5dd6 (patch) | |
tree | c104bd7552c5c5373af092c5d043001e72aa3efb /tests/serd_test.c | |
parent | cedc9530cee8518f92d949984d173be1e707e31e (diff) | |
download | serd-86681fbf464d47f8962238d472a7d521643d5dd6.tar.gz serd-86681fbf464d47f8962238d472a7d521643d5dd6.tar.bz2 serd-86681fbf464d47f8962238d472a7d521643d5dd6.zip |
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.
Diffstat (limited to 'tests/serd_test.c')
-rw-r--r-- | tests/serd_test.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index d41bbfc1..4a1c2485 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; } |