diff options
author | David Robillard <d@drobilla.net> | 2020-08-14 13:46:00 +0200 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2020-10-27 13:13:58 +0100 |
commit | 00c7fe7bb9b7c409c3922431c9fefd348e4f8346 (patch) | |
tree | a5d637e876b1dceb25708a2291e4b5db527f7c22 /tests/serd_test.c | |
parent | 3eff44c4784c6f0cfdc8c857ff47f8bdd3ae713c (diff) | |
download | serd-00c7fe7bb9b7c409c3922431c9fefd348e4f8346.tar.gz serd-00c7fe7bb9b7c409c3922431c9fefd348e4f8346.tar.bz2 serd-00c7fe7bb9b7c409c3922431c9fefd348e4f8346.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 standard C API.
Diffstat (limited to 'tests/serd_test.c')
-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 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 { |