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 /src | |
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 'src')
-rw-r--r-- | src/string.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/string.c b/src/string.c index 3f068a1d..1e7e9348 100644 --- a/src/string.c +++ b/src/string.c @@ -109,7 +109,7 @@ read_sign(const char** sptr) } double -serd_strtod(const char* str, char** endptr) +serd_strtod(const char* str, size_t* end) { double result = 0.0; @@ -145,8 +145,8 @@ serd_strtod(const char* str, char** endptr) result *= pow(10, expt * expt_sign); } - if (endptr) { - *endptr = (char*)s; + if (end) { + *end = s - str; } return result * sign; |