diff options
author | David Robillard <d@drobilla.net> | 2016-07-07 23:50:39 -0400 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-06-21 18:12:03 +0200 |
commit | 654d0cffd006573d7eedba19fbf2e627f04737b3 (patch) | |
tree | 018b4a49a67ae425d1bdbf86315b5e87e5584004 /tests | |
parent | 05601551a3e8350da8053f47ceb121c8de0e692c (diff) | |
download | serd-654d0cffd006573d7eedba19fbf2e627f04737b3.tar.gz serd-654d0cffd006573d7eedba19fbf2e627f04737b3.tar.bz2 serd-654d0cffd006573d7eedba19fbf2e627f04737b3.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')
-rw-r--r-- | tests/serd_test.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/serd_test.c b/tests/serd_test.c index 5429cbd9..85c9db27 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)); } static SerdStatus |