aboutsummaryrefslogtreecommitdiffstats
path: root/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-08-14 13:46:00 +0200
committerDavid Robillard <d@drobilla.net>2020-10-27 13:13:58 +0100
commit00c7fe7bb9b7c409c3922431c9fefd348e4f8346 (patch)
treea5d637e876b1dceb25708a2291e4b5db527f7c22 /serd
parent3eff44c4784c6f0cfdc8c857ff47f8bdd3ae713c (diff)
downloadserd-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 'serd')
-rw-r--r--serd/serd.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/serd/serd.h b/serd/serd.h
index b3ecb850..1963ff6b 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -320,13 +320,15 @@ serd_strlen(const char* str, SerdNodeFlags* flags);
/**
Parse a string to a double.
- The API of this function is identical to the standard C strtod function,
+ The API of this function is similar to the standard C strtod function,
except this function is locale-independent and always matches the lexical
- format used in the Turtle grammar (the decimal point is always ".").
+ format used in the Turtle grammar (the decimal point is always "."). The
+ end parameter is an offset from the start of `str` to avoid the
+ const-correctness issues of the strtod API.
*/
SERD_API
double
-serd_strtod(const char* str, char** endptr);
+serd_strtod(const char* str, size_t* end);
/**
Decode a base64 string.