aboutsummaryrefslogtreecommitdiffstats
path: root/serd
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2016-07-07 23:50:39 -0400
committerDavid Robillard <d@drobilla.net>2018-12-30 17:56:22 -0500
commit86681fbf464d47f8962238d472a7d521643d5dd6 (patch)
treec104bd7552c5c5373af092c5d043001e72aa3efb /serd
parentcedc9530cee8518f92d949984d173be1e707e31e (diff)
downloadserd-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 '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 3895f93d..5c28aa50 100644
--- a/serd/serd.h
+++ b/serd/serd.h
@@ -316,13 +316,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.